qemu-e2k/hw/virtio
Stefan Hajnoczi bd58ab40c3 virtio: make it possible to detach host notifier from any thread
virtio_queue_aio_detach_host_notifier() does two things:
1. It removes the fd handler from the event loop.
2. It processes the virtqueue one last time.

The first step can be peformed by any thread and without taking the
AioContext lock.

The second step may need the AioContext lock (depending on the device
implementation) and runs in the thread where request processing takes
place. virtio-blk and virtio-scsi therefore call
virtio_queue_aio_detach_host_notifier() from a BH that is scheduled in
AioContext.

The next patch will introduce a .drained_begin() function that needs to
call virtio_queue_aio_detach_host_notifier(). .drained_begin() functions
cannot call aio_poll() to wait synchronously for the BH. It is possible
for a .drained_poll() callback to asynchronously wait for the BH, but
that is more complex than necessary here.

Move the virtqueue processing out to the callers of
virtio_queue_aio_detach_host_notifier() so that the function can be
called from any thread. This is in preparation for the next patch.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20230516190238.8401-17-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2023-05-30 17:32:02 +02:00
..
Kconfig
meson.build
trace-events
trace.h
vdpa-dev-pci.c
vdpa-dev.c
vhost-backend.c
vhost-iova-tree.c
vhost-iova-tree.h
vhost-scsi-pci.c
vhost-shadow-virtqueue.c vhost: fix possible wrap in SVQ descriptor ring 2023-05-19 01:36:09 -04:00
vhost-shadow-virtqueue.h vhost: fix possible wrap in SVQ descriptor ring 2023-05-19 01:36:09 -04:00
vhost-stub.c
vhost-user-blk-pci.c
vhost-user-fs-pci.c
vhost-user-fs.c
vhost-user-gpio-pci.c
vhost-user-gpio.c
vhost-user-i2c-pci.c
vhost-user-i2c.c virtio: i2c: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX 2023-04-24 22:56:55 -04:00
vhost-user-input-pci.c
vhost-user-rng-pci.c
vhost-user-rng.c
vhost-user-scsi-pci.c
vhost-user-vsock-pci.c
vhost-user-vsock.c
vhost-user.c hostmem-file: add offset option 2023-05-23 16:47:03 +02:00
vhost-vdpa.c vhost-vdpa: Add support for vIOMMU. 2023-05-19 10:30:46 -04:00
vhost-vsock-common.c
vhost-vsock-pci.c
vhost-vsock.c
vhost.c vhost: expose function vhost_dev_has_iommu() 2023-05-19 10:30:46 -04:00
virtio-9p-pci.c
virtio-balloon-pci.c
virtio-balloon.c hw: replace most qemu_bh_new calls with qemu_bh_new_guarded 2023-04-28 11:31:54 +02:00
virtio-blk-pci.c
virtio-bus.c
virtio-config-io.c
virtio-crypto-pci.c
virtio-crypto.c virtio-crypto: fix NULL pointer dereference in virtio_crypto_free_request 2023-05-19 10:30:46 -04:00
virtio-hmp-cmds.c
virtio-input-host-pci.c
virtio-input-pci.c virtio-input-pci: add virtio-multitouch-pci 2023-05-28 13:08:25 +04:00
virtio-iommu-pci.c
virtio-iommu.c
virtio-mem-pci.c
virtio-mem-pci.h
virtio-mem.c virtio-mem: Default to "unplugged-inaccessible=on" with 8.1 on x86-64 2023-05-19 10:30:46 -04:00
virtio-mmio.c virtio: refresh vring region cache after updating a virtqueue size 2023-04-21 03:08:21 -04:00
virtio-net-pci.c
virtio-pci.c virtio-pci: add handling of PCI ATS and Device-TLB enable/disable 2023-05-19 10:30:46 -04:00
virtio-pmem-pci.c
virtio-pmem-pci.h
virtio-pmem.c thread-pool: avoid passing the pool parameter every time 2023-04-25 13:17:28 +02:00
virtio-qmp.c virtio: qmp: fix memory leak 2023-05-26 12:34:17 +02:00
virtio-qmp.h
virtio-rng-pci.c
virtio-rng.c
virtio-scsi-pci.c
virtio-serial-pci.c
virtio-stub.c
virtio.c virtio: make it possible to detach host notifier from any thread 2023-05-30 17:32:02 +02:00