From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alI0U-0005mg-QM for qemu-devel@nongnu.org; Wed, 30 Mar 2016 11:26:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alI0Q-0004no-Oc for qemu-devel@nongnu.org; Wed, 30 Mar 2016 11:26:06 -0400 Received: from e06smtp05.uk.ibm.com ([195.75.94.101]:43562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alI0Q-0004nF-Eq for qemu-devel@nongnu.org; Wed, 30 Mar 2016 11:26:02 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 30 Mar 2016 16:26:01 +0100 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 92B1817D8056 for ; Wed, 30 Mar 2016 16:26:36 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u2UFPwLw62259322 for ; Wed, 30 Mar 2016 15:25:58 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u2UFPvcm029748 for ; Wed, 30 Mar 2016 09:25:57 -0600 Date: Wed, 30 Mar 2016 17:25:56 +0200 From: Cornelia Huck Message-ID: <20160330172556.68f41e2b.cornelia.huck@de.ibm.com> In-Reply-To: <1459342088-24311-7-git-send-email-pbonzini@redhat.com> References: <1459342088-24311-1-git-send-email-pbonzini@redhat.com> <1459342088-24311-7-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 6/9] virtio-blk: use aio handler for data plane List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: borntraeger@de.ibm.com, famz@redhat.com, qemu-devel@nongnu.org, mst@redhat.com On Wed, 30 Mar 2016 14:48:05 +0200 Paolo Bonzini wrote: > From: "Michael S. Tsirkin" > > In addition to handling IO in vcpu thread and in io thread, dataplane > introduces yet another mode: handling it by aio. > > This reuses the same handler as previous modes, which triggers races as > these were not designed to be reentrant. > > Use a separate handler just for aio, and disable regular handlers when > dataplane is active. > > Signed-off-by: Michael S. Tsirkin > Signed-off-by: Paolo Bonzini > --- > hw/block/dataplane/virtio-blk.c | 13 +++++++++++++ > hw/block/virtio-blk.c | 27 +++++++++++++++++---------- > include/hw/virtio/virtio-blk.h | 2 ++ > 3 files changed, 32 insertions(+), 10 deletions(-) > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index 77221c1..47ad9ed 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -577,20 +577,11 @@ void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) > } > } > > -static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) > +void virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq) > { > - VirtIOBlock *s = VIRTIO_BLK(vdev); > VirtIOBlockReq *req; > MultiReqBuffer mrb = {}; > > - /* Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start > - * dataplane here instead of waiting for .set_status(). > - */ > - if (s->dataplane && !s->dataplane_started) { > - virtio_blk_data_plane_start(s->dataplane); > - return; > - } > - > assert(atomic_fetch_inc(&s->reentrancy_test) == 0); Hm, based on wrong branch? > blk_io_plug(s->blk); >