From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwoxV-0004zo-IP for qemu-devel@nongnu.org; Wed, 19 Oct 2016 07:22:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwoxS-0007sp-Ci for qemu-devel@nongnu.org; Wed, 19 Oct 2016 07:22:57 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54723) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwoxS-0007qB-4G for qemu-devel@nongnu.org; Wed, 19 Oct 2016 07:22:54 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9JBJm28140582 for ; Wed, 19 Oct 2016 07:22:52 -0400 Received: from e06smtp06.uk.ibm.com (e06smtp06.uk.ibm.com [195.75.94.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 2662shwwxb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 19 Oct 2016 07:22:52 -0400 Received: from localhost by e06smtp06.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Oct 2016 12:22:49 +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 D7A4317D806E for ; Wed, 19 Oct 2016 12:24:58 +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 u9JBMlAQ3604936 for ; Wed, 19 Oct 2016 11:22:47 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 u9JBMlV9005908 for ; Wed, 19 Oct 2016 05:22:47 -0600 Date: Wed, 19 Oct 2016 13:22:45 +0200 From: Cornelia Huck In-Reply-To: <1476100421-28772-13-git-send-email-pbonzini@redhat.com> References: <1476100421-28772-1-git-send-email-pbonzini@redhat.com> <1476100421-28772-13-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20161019132245.5229b999.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH 12/13] virtio: inline virtio_queue_set_host_notifier_fd_handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com, borntraeger@de.ibm.com, famz@redhat.com, mst@redhat.com On Mon, 10 Oct 2016 13:53:40 +0200 Paolo Bonzini wrote: > Of the three possible parameter combinations for > virtio_queue_set_host_notifier_fd_handler: > > - assign=true/set_handler=true is only called from > virtio_device_start_ioeventfd > > - assign=false/set_handler=false is called from > set_host_notifier_internal but it only does something when > reached from virtio_device_stop_ioeventfd_impl; otherwise > there is no EventNotifier set on qemu_get_aio_context(). > > - assign=true/set_handler=false is called from > set_host_notifier_internal, but it is not doing anything: > with the new start_ioeventfd and stop_ioeventfd methods, > there is never an EventNotifier set on qemu_get_aio_context() > at this point. This is enforced by the assertion in > virtio_bus_set_host_notifier. > > Signed-off-by: Paolo Bonzini > --- > hw/virtio/virtio-bus.c | 19 +++++++++++-------- > hw/virtio/virtio.c | 27 +++++++++------------------ > include/hw/virtio/virtio.h | 3 +-- > 3 files changed, 21 insertions(+), 28 deletions(-) > > diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c > index d6feaaf..96b7e76 100644 > --- a/hw/virtio/virtio-bus.c > +++ b/hw/virtio/virtio-bus.c > @@ -163,19 +163,22 @@ static int set_host_notifier_internal(DeviceState *proxy, VirtioBusState *bus, > __func__, strerror(-r), r); > return r; > } > - virtio_queue_set_host_notifier_fd_handler(vq, true, false); > - r = k->ioeventfd_assign(proxy, notifier, n, assign); > + r = k->ioeventfd_assign(proxy, notifier, n, true); > if (r < 0) { > error_report("%s: unable to assign ioeventfd: %d", __func__, r); > - virtio_queue_set_host_notifier_fd_handler(vq, false, false); > - event_notifier_cleanup(notifier); > - return r; > + goto cleanup_event_notifier; > } > + return 0; > } else { > - k->ioeventfd_assign(proxy, notifier, n, assign); > - virtio_queue_set_host_notifier_fd_handler(vq, false, false); > - event_notifier_cleanup(notifier); > + k->ioeventfd_assign(proxy, notifier, n, false); > } > + > +cleanup_event_notifier: > + /* Test and clear notifier before after disabling event, Now is the time to get rid of "before after" :) > + * in case poll callback didn't have time to run. > + */ > + virtio_queue_host_notifier_read(notifier); > + event_notifier_cleanup(notifier); > return r; > } Reviewed-by: Cornelia Huck