Received: from eggs.gnu.org ([2001:4830:134:3::10]:33330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anlMv-0002bN-7k for qemu-devel@nongnu.org; Wed, 06 Apr 2016 07:11:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anlMs-0000jQ-1w for qemu-devel@nongnu.org; Wed, 06 Apr 2016 07:11:29 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:45531) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anlMr-0000j6-Nc for qemu-devel@nongnu.org; Wed, 06 Apr 2016 07:11:25 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Apr 2016 12:11:22 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id D13451B08061 for ; Wed, 6 Apr 2016 12:11:57 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u36BBJJM7668182 for ; Wed, 6 Apr 2016 11:11:19 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u36BBJqL009592 for ; Wed, 6 Apr 2016 05:11:19 -0600 Date: Wed, 6 Apr 2016 13:11:17 +0200 From: Cornelia Huck Message-ID: <20160406131117.368692e7.cornelia.huck@de.ibm.com> In-Reply-To: <1459937788-31904-5-git-send-email-pbonzini@redhat.com> References: <1459937788-31904-1-git-send-email-pbonzini@redhat.com> <1459937788-31904-5-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 4/7] virtio: add aio handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: famz@redhat.com, borntraeger@de.ibm.com, mst@redhat.com, qemu-devel@nongnu.org, tubo@linux.vnet.ibm.com, stefanha@redhat.com On Wed, 6 Apr 2016 12:16:25 +0200 Paolo Bonzini wrote: > From: "Michael S. Tsirkin" > > In addition to handling IO in vcpu thread and in io thread, blk dataplane > introduces yet another mode: handling it by AioContext. > > Currently, this reuses the same handler as previous modes, > which triggers races as these were not designed to be reentrant. > Add instead a separate handler just for aio; this will make > it possible to disable regular handlers when dataplane is active. > > Signed-off-by: Michael S. Tsirkin > Signed-off-by: Paolo Bonzini > --- > hw/virtio/virtio.c | 36 ++++++++++++++++++++++++++++++++---- > include/hw/virtio/virtio.h | 3 +++ > 2 files changed, 35 insertions(+), 4 deletions(-) > > +static void virtio_queue_notify_aio_vq(VirtQueue *vq) > +{ > + if (vq->vring.desc && vq->handle_aio_output) { > + VirtIODevice *vdev = vq->vdev; > + > + trace_virtio_queue_notify(vdev, vq - vdev->vq, vq); > + vq->handle_aio_output(vdev, vq); > + } > +} > + So this avoids reentrancy, but might we miss one notify if ->handle_aio_output has already been unset? What am I missing?