From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aViHt-000403-IG for qemu-devel@nongnu.org; Tue, 16 Feb 2016 11:15:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aViHp-00022D-Gp for qemu-devel@nongnu.org; Tue, 16 Feb 2016 11:15:41 -0500 Received: from e06smtp05.uk.ibm.com ([195.75.94.101]:53963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aViHp-00020L-8M for qemu-devel@nongnu.org; Tue, 16 Feb 2016 11:15:37 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 16 Feb 2016 16:15:34 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 88AB217D805D for ; Tue, 16 Feb 2016 16:15:50 +0000 (GMT) Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u1GGFWFE43253780 for ; Tue, 16 Feb 2016 16:15:32 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u1GGFWTI012053 for ; Tue, 16 Feb 2016 09:15:32 -0700 Date: Tue, 16 Feb 2016 17:15:30 +0100 From: Cornelia Huck Message-ID: <20160216171530.6f335a81.cornelia.huck@de.ibm.com> In-Reply-To: <56C34414.90809@redhat.com> References: <1455470231-5223-1-git-send-email-pbonzini@redhat.com> <1455470231-5223-6-git-send-email-pbonzini@redhat.com> <20160215185818.14c47ef5.cornelia.huck@de.ibm.com> <56C34414.90809@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 Tue, 16 Feb 2016 16:45:24 +0100 Paolo Bonzini wrote: > On 15/02/2016 18:58, Cornelia Huck wrote: > > 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. > > Actually, I can do better by moving the flag entirely within > hw/block/virtio-blk.c: > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index e04c8f5..34bae8e 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -590,6 +590,7 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) > * dataplane here instead of waiting for .set_status(). > */ > if (s->dataplane && !s->dataplane_started) { > + s->dataplane_started = true; > virtio_blk_data_plane_start(s->dataplane); > return; > } > @@ -658,8 +659,9 @@ static void virtio_blk_reset(VirtIODevice *vdev) > aio_context_acquire(ctx); > blk_drain(s->blk); > > - if (s->dataplane) { > + if (s->dataplane && s->dataplane_started) { > virtio_blk_data_plane_stop(s->dataplane); > + s->dataplane_started = false; > } > aio_context_release(ctx); > > > Does it look better? I think yes. Hm... this seems to guarantee that _start()/_stop() never runs concurrently, doesn't it? Could we get rid of the ->starting/->stopping flags as well? ...and ->disabled as well, since we try just once until we stop?