qemu-e2k/hw
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
..
9pfs 9p: Use variable length suffixes for inode remapping 2019-10-10 11:36:23 +02:00
acpi hw/i386: split PCMachineState deriving X86MachineState from it 2019-10-22 09:39:50 +02:00
adc
alpha hw: Move MC146818 device from hw/timer/ to hw/rtc/ subdirectory 2019-10-24 20:13:10 +02:00
arm hw/arm/boot: Rebuild hflags when modifying CPUState at boot 2019-11-01 20:41:00 +00:00
audio
block bootdevice: Gather LCHS from all relevant devices 2019-10-31 11:47:29 -04:00
bt
char virtio: basic packed virtqueue support 2019-10-25 07:46:22 -04:00
core TCG Plugins initial implementation 2019-10-30 14:10:32 +00:00
cpu
cris
display hw/m68k: add Nubus macfb video card 2019-10-28 19:06:49 +01:00
dma hw/dma/xilinx_axidma.c: Switch to transaction-based ptimer API 2019-10-24 17:16:29 +01:00
gpio hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model 2019-10-24 17:16:27 +01:00
hppa hw: Move MC146818 device from hw/timer/ to hw/rtc/ subdirectory 2019-10-24 20:13:10 +02:00
hyperv
i2c aspeed/i2c: Add AST2600 support 2019-10-15 18:09:04 +01:00
i386 hw/i386: AMD-Vi IVRS DMA alias support 2019-11-05 04:04:21 -05:00
ide bootdevice: Gather LCHS from all relevant devices 2019-10-31 11:47:29 -04:00
input hw/input/lm832x: Convert reset handler to DeviceReset 2019-10-15 18:18:08 -03:00
intc core: replace getpagesize() with qemu_real_host_page_size 2019-10-26 15:38:06 +02:00
ipack
ipmi ipmi: Add an SMBus IPMI interface 2019-09-20 14:08:10 -05:00
isa hw/isa/vt82c686: Convert reset handler to DeviceReset 2019-10-15 18:18:08 -03:00
lm32
m68k hw/m68k: define Macintosh Quadra 800 2019-10-28 19:06:53 +01:00
mem memory-device: simplify Makefile.objs conditions 2019-10-22 09:38:42 +02:00
microblaze microblaze: fix leak of fdevice tree blob 2019-10-04 18:49:16 +02:00
mips hw: Move MC146818 device from hw/timer/ to hw/rtc/ subdirectory 2019-10-24 20:13:10 +02:00
misc Add Macintosh Quadra 800 machine in hw/m68k 2019-10-29 16:27:48 +00:00
moxie
net virtio_net: use RCU_READ_LOCK_GUARD 2019-10-29 18:56:45 -04:00
nios2
nubus hw/m68k: add Nubus support 2019-10-28 19:06:47 +01:00
nvram bootdevice: FW_CFG interface for LCHS values 2019-10-31 11:47:38 -04:00
openrisc
pci pci: Use PCI aliases when determining device IOMMU address space 2019-11-05 04:04:21 -05:00
pci-bridge
pci-host
pcmcia
ppc core: replace getpagesize() with qemu_real_host_page_size 2019-10-26 15:38:06 +02:00
rdma core: replace getpagesize() with qemu_real_host_page_size 2019-10-26 15:38:06 +02:00
riscv riscv/boot: Fix possible memory leak 2019-10-28 08:46:06 -07:00
rtc Merge commit 'df84f17' into HEAD 2019-10-26 15:38:02 +02:00
s390x target/s390x: Remove ilen parameter from s390_program_interrupt 2019-10-09 12:49:01 +02:00
scsi bootdevice: Gather LCHS from all relevant devices 2019-10-31 11:47:29 -04:00
sd hw/sd/sdhci: Add dummy Samsung SDHCI controller 2019-10-22 17:44:00 +01:00
semihosting
sh4
smbios smbios:ipmi: Ignore IPMI devices with no fwinfo function 2019-09-20 14:08:10 -05:00
sparc hw: Move M48T59 device from hw/timer/ to hw/rtc/ subdirectory 2019-10-24 20:20:45 +02:00
sparc64 hw: Move sun4v hypervisor RTC from hw/timer/ to hw/rtc/ subdirectory 2019-10-24 20:23:15 +02:00
ssi aspeed/smc: Add AST2600 support 2019-10-15 18:09:04 +01:00
timer Fix typos and docs, trivial changes and RTC devices split 2019-10-25 14:17:08 +01:00
tpm
tricore
unicore32
usb usbaudio: change playback counters to 64 bit 2019-10-18 08:14:05 +02:00
vfio vfio: unplug failover primary device before migration 2019-10-29 18:55:26 -04:00
virtio virtio: notify virtqueue via host notifier when available 2019-11-06 06:35:00 -05:00
watchdog hw: wdt_aspeed: Add AST2600 support 2019-10-15 18:09:04 +01:00
xen xen-bus: only set the xen device frontend state if it is missing 2019-09-24 12:21:29 +01:00
xenpv
xtensa hw/xtensa: add virt machine 2019-10-18 20:38:10 -07:00
Kconfig Add Macintosh Quadra 800 machine in hw/m68k 2019-10-29 16:27:48 +00:00
Makefile.objs Add Macintosh Quadra 800 machine in hw/m68k 2019-10-29 16:27:48 +00:00