qemu-e2k/include/hw/virtio
Stefan Hajnoczi fcccb271e0 virtio: notify virtqueue via host notifier when available
Host notifiers are used in several cases:
1. Traditional ioeventfd where virtqueue notifications are handled in
   the main loop thread.
2. IOThreads (aio_handle_output) where virtqueue notifications are
   handled in an IOThread AioContext.
3. vhost where virtqueue notifications are handled by kernel vhost or
   a vhost-user device backend.

Most virtqueue notifications from the guest use the ioeventfd mechanism,
but there are corner cases where QEMU code calls virtio_queue_notify().
This currently honors the host notifier for the IOThreads
aio_handle_output case, but not for the vhost case.  The result is that
vhost does not receive virtqueue notifications from QEMU when
virtio_queue_notify() is called.

This patch extends virtio_queue_notify() to set the host notifier
whenever it is enabled instead of calling the vq->(aio_)handle_output()
function directly.  We track the host notifier state for each virtqueue
separately since some devices may use it only for certain virtqueues.

This fixes the vhost case although it does add a trip through the
eventfd for the traditional ioeventfd case.  I don't think it's worth
adding a fast path for the traditional ioeventfd case because calling
virtio_queue_notify() is rare when ioeventfd is enabled.

Reported-by: Felipe Franciosi <felipe@nutanix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20191105140946.165584-1-stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2019-11-06 06:35:00 -05:00
..
vhost-backend.h vhost-user: add vhost_user_gpu_set_socket() 2019-05-29 06:29:07 +02:00
vhost-scsi-common.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
vhost-scsi.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
vhost-user-blk.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
vhost-user-fs.h virtio: add vhost-user-fs base device 2019-10-05 17:43:55 -04:00
vhost-user-scsi.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
vhost-user.h
vhost-vsock.h
vhost.h Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
virtio-access.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
virtio-balloon.h virtio-balloon: Use temporary PBP only 2019-07-25 07:58:03 -04:00
virtio-blk.h
virtio-bus.h Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
virtio-crypto.h
virtio-gpu-bswap.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
virtio-gpu-pci.h hw/display: add vhost-user-vga & gpu-pci 2019-05-29 06:30:45 +02:00
virtio-gpu-pixman.h virtio-gpu: add a pixman helper header 2019-05-29 06:29:07 +02:00
virtio-gpu.h edid: flip the default to enabled 2019-06-13 09:34:50 +02:00
virtio-input.h
virtio-mmio.h hw/virtio: Factorize virtio-mmio headers 2019-10-22 09:38:42 +02:00
virtio-net.h net/virtio: add failover support 2019-10-29 18:55:26 -04:00
virtio-pmem.h Include sysemu/hostmem.h less 2019-08-16 13:31:53 +02:00
virtio-rng.h virtio-rng: Keep the default backend out of VirtIORNGConf 2019-09-04 06:32:51 -04:00
virtio-scsi.h virtio-scsi: remove unused argument to virtio_scsi_common_realize 2019-07-19 19:04:38 +02:00
virtio-serial.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
virtio.h virtio: notify virtqueue via host notifier when available 2019-11-06 06:35:00 -05:00