From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSYc-0004UU-NZ for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:46:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKSYY-0005Y2-IW for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:46:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSYY-0005Xy-A8 for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:46:38 -0400 Date: Tue, 5 Jul 2016 18:46:34 +0300 From: "Michael S. Tsirkin" Message-ID: <20160705184634-mutt-send-email-mst@redhat.com> References: <1467733400-17206-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1467733400-17206-1-git-send-email-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL v2 09/30] virtio: revert host notifiers to old semantics List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Cornelia Huck , Peter Lieven , Jason Wang , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau From: Cornelia Huck The host notifier rework tried both to unify host notifiers across transports and plug a possible hole during host notifier re-assignment. Unfortunately, this meant a change in semantics that breaks vhost and iSCSI+dataplane. As the minimal fix, keep the common host notifier code but revert to the old semantics so that we have time to figure out the proper fix. Fixes: 6798e245a3 ("virtio-bus: common ioeventfd infrastructure") Reported-by: Peter Lieven Reported-by: Jason Wang Reported-by: Marc-Andr=E9 Lureau Signed-off-by: Cornelia Huck Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Tested-by: Marc-Andr=E9 Lureau Reviewed-by: Jason Wang Tested-by: Jason Wang Tested-by: Peter Lieven --- hw/virtio/virtio-bus.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index 1313760..a85b7c8 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -176,8 +176,8 @@ static int set_host_notifier_internal(DeviceState *pr= oxy, VirtioBusState *bus, return r; } } else { - virtio_queue_set_host_notifier_fd_handler(vq, false, false); k->ioeventfd_assign(proxy, notifier, n, assign); + virtio_queue_set_host_notifier_fd_handler(vq, false, false); event_notifier_cleanup(notifier); } return r; @@ -251,31 +251,25 @@ int virtio_bus_set_host_notifier(VirtioBusState *bu= s, int n, bool assign) { VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(bus); DeviceState *proxy =3D DEVICE(BUS(bus)->parent); - VirtIODevice *vdev =3D virtio_bus_get_device(bus); - VirtQueue *vq =3D virtio_get_queue(vdev, n); =20 if (!k->ioeventfd_started) { return -ENOSYS; } + k->ioeventfd_set_disabled(proxy, assign); if (assign) { /* * Stop using the generic ioeventfd, we are doing eventfd handli= ng * ourselves below + * + * FIXME: We should just switch the handler and not deassign the + * ioeventfd. + * Otherwise, there's a window where we don't have an + * ioeventfd and we may end up with a notification where + * we don't expect one. */ - k->ioeventfd_set_disabled(proxy, true); - } - /* - * Just switch the handler, don't deassign the ioeventfd. - * Otherwise, there's a window where we don't have an - * ioeventfd and we may end up with a notification where - * we don't expect one. - */ - virtio_queue_set_host_notifier_fd_handler(vq, assign, !assign); - if (!assign) { - /* Use generic ioeventfd handler again. */ - k->ioeventfd_set_disabled(proxy, false); + virtio_bus_stop_ioeventfd(bus); } - return 0; + return set_host_notifier_internal(proxy, bus, n, assign, false); } =20 static char *virtio_bus_get_dev_path(DeviceState *dev) --=20 MST