]> Git Repo - qemu.git/commit
virtio: introduce grab/release_ioeventfd to fix vhost
authorPaolo Bonzini <[email protected]>
Fri, 18 Nov 2016 15:07:00 +0000 (16:07 +0100)
committerMichael S. Tsirkin <[email protected]>
Fri, 18 Nov 2016 15:29:25 +0000 (17:29 +0200)
commit310837de6c1e0badfd736b1b316b1698c53120a7
treeeeb77c5a02121666e56900bc5da0cd578dfcd7f5
parent600f5ce356b44d8fa5a611ff6b034eb95ecf04e7
virtio: introduce grab/release_ioeventfd to fix vhost

Following the recent refactoring of virtio notifiers [1], more specifically
the patch ed08a2a0b ("virtio: use virtio_bus_set_host_notifier to
start/stop ioeventfd") that uses virtio_bus_set_host_notifier [2]
by default, core virtio code requires 'ioeventfd_started' to be set
to true/false when the host notifiers are configured.

When vhost is stopped and started, however, there is a stop followed by
another start. Since ioeventfd_started was never set to true, the 'stop'
operation triggered by virtio_bus_set_host_notifier() will not result
in a call to virtio_pci_ioeventfd_assign(assign=false). This leaves
the memory regions with stale notifiers and results on the next start
triggering the following assertion:

  kvm_mem_ioeventfd_add: error adding ioeventfd: File exists
  Aborted

This patch reintroduces (hopefully in a cleaner way) the concept
that was present with ioeventfd_disabled before the refactoring.
When ioeventfd_grabbed>0, ioeventfd_started tracks whether ioeventfd
should be enabled or not, but ioeventfd is actually not started at
all until vhost releases the host notifiers.

[1] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07748.html
[2] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07760.html

Reported-by: Felipe Franciosi <[email protected]>
Reported-by: Christian Borntraeger <[email protected]>
Reported-by: Alex Williamson <[email protected]>
Fixes: ed08a2a0b ("virtio: use virtio_bus_set_host_notifier to start/stop ioeventfd")
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Tested-by: Alexey Kardashevskiy <[email protected]>
Tested-by: Farhan Ali <[email protected]>
Tested-by: Alex Williamson <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
hw/virtio/vhost.c
hw/virtio/virtio-bus.c
hw/virtio/virtio.c
include/hw/virtio/virtio-bus.h
include/hw/virtio/virtio.h
This page took 0.024466 seconds and 4 git commands to generate.