From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVNPq-0002uv-6E for qemu-devel@nongnu.org; Mon, 15 Feb 2016 12:58:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVNPl-0000Xb-4S for qemu-devel@nongnu.org; Mon, 15 Feb 2016 12:58:30 -0500 Received: from e06smtp05.uk.ibm.com ([195.75.94.101]:41625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVNPk-0000XP-QS for qemu-devel@nongnu.org; Mon, 15 Feb 2016 12:58:25 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 15 Feb 2016 17:58:23 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id ACB1B17D8042 for ; Mon, 15 Feb 2016 17:58:38 +0000 (GMT) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u1FHwLDM2752852 for ; Mon, 15 Feb 2016 17:58:21 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u1FHwLbx015090 for ; Mon, 15 Feb 2016 10:58:21 -0700 Date: Mon, 15 Feb 2016 18:58:18 +0100 From: Cornelia Huck Message-ID: <20160215185818.14c47ef5.cornelia.huck@de.ibm.com> In-Reply-To: <1455470231-5223-6-git-send-email-pbonzini@redhat.com> References: <1455470231-5223-1-git-send-email-pbonzini@redhat.com> <1455470231-5223-6-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/8] virtio-blk: fix "disabled data plane" mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com, mst@redhat.com On Sun, 14 Feb 2016 18:17:08 +0100 Paolo Bonzini wrote: > In disabled mode, virtio-blk dataplane seems to be enabled, but flow > actually goes through the normal virtio path. This patch simplifies a bit > the handling of disabled mode. In disabled mode, virtio_blk_handle_output > might be called even if s->dataplane is not NULL. > > This is a bit tricky, because the current check for s->dataplane will > always trigger, causing a continuous stream of calls to > virtio_blk_data_plane_start. Unfortunately, these calls will not > do anything. > To fix this, set the "started" flag even in disabled > mode, and skip virtio_blk_data_plane_start if the started flag is true. > The resulting changes also prepare the code for the next patch, were > virtio-blk dataplane will reuse the same virtio_blk_handle_output function > as "regular" virtio-blk. > > Because struct VirtIOBlockDataPlane is opaque in virtio-blk.c, we have > to move s->dataplane->started inside struct VirtIOBlock. It seems a bit odd to me that ->started is the only state that is not inside the dataplane struct... this approach saves a function call for an accessor, though. > > Signed-off-by: Paolo Bonzini > --- > hw/block/dataplane/virtio-blk.c | 21 +++++++++------------ > hw/block/virtio-blk.c | 2 +- > include/hw/virtio/virtio-blk.h | 1 + > 3 files changed, 11 insertions(+), 13 deletions(-) > > @@ -319,9 +314,10 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) > k->set_guest_notifiers(qbus->parent, 1, false); > fail_guest_notifiers: > vring_teardown(&s->vring, s->vdev, 0); > - s->disabled = true; > fail_vring: > + s->disabled = true; I originally introduced ->disabled to cover (possibly temporary) failures to set up notifiers, but I guess this doesn't hurt. > s->starting = false; > + vblk->dataplane_started = true; > } > > /* Context: QEMU global mutex held */ After spending some time wrapping my head around it again, this looks sane to me. Reviewed-by: Cornelia Huck