Received: from eggs.gnu.org ([2001:4830:134:3::10]:59439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biJr5-00031E-T3 for qemu-devel@nongnu.org; Fri, 09 Sep 2016 07:20:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biJr0-0003Q5-9f for qemu-devel@nongnu.org; Fri, 09 Sep 2016 07:20:23 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35069 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biJr0-0003Px-3R for qemu-devel@nongnu.org; Fri, 09 Sep 2016 07:20:18 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u89BHxMR034449 for ; Fri, 9 Sep 2016 07:20:17 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 25bc2qxc7e-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 09 Sep 2016 07:20:17 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 9 Sep 2016 12:20:16 +0100 Date: Fri, 9 Sep 2016 13:20:11 +0200 From: Cornelia Huck In-Reply-To: <74bd31bc-a4ce-295a-b138-f9ae872a618a@redhat.com> References: <1473416072-7063-1-git-send-email-maxime.coquelin@redhat.com> <1473416072-7063-2-git-send-email-maxime.coquelin@redhat.com> <20160909123348.4779e59c.cornelia.huck@de.ibm.com> <20160909125536.3af41223.cornelia.huck@de.ibm.com> <74bd31bc-a4ce-295a-b138-f9ae872a618a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20160909132011.7b84d4ca.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH 1/2] virtio: Add backend feature testing functionnality List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: Maxime Coquelin , mst@redhat.com, qemu-devel@nongnu.org, vkaplans@redhat.com, qemu-stable@nongnu.org On Fri, 9 Sep 2016 14:02:17 +0300 Marcel Apfelbaum wrote: > I was thinking to keep the same function proposed by Maxime and change it to negate things: > > /* > * A missing feature before all negotiations finished will still be missing at the end. > */ > bool virtio_test_backend_unsupported_feature(VirtIODevice *vdev, > unsigned int fbit, Error **errp) > { > VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); > uint64_t feature; > > virtio_add_feature(&feature, fbit); > > assert(k->get_features != NULL); > feature = k->get_features(vdev, feature, errp); > > return !virtio_has_feature(feature, fbit); > } > > We only check if the feature was not there from the start. I think you'll still end up with the same problem (overindicating unsupportedness), as you start out with an otherwise empty feature set, causing features with dependencies to be removed. I fear that anything starting with an incomplete feature list will have that problem. Maybe it would be better to limit this to the one bit we currently want to test (VERSION_1)? We know the semantics of that one. Less general, but also less headaches.