qemu/hw
Paolo Bonzini 310837de6c 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 <felipe@nutanix.com>
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reported-by: Alex Williamson <alex.williamson@redhat.com>
Fixes: ed08a2a0b ("virtio: use virtio_bus_set_host_notifier to start/stop ioeventfd")
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Tested-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Tested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-11-18 17:29:25 +02:00
..
9pfs 9pfs: drop excessive error message from virtfs_reset() 2016-11-01 12:03:03 +01:00
acpi nvdimm acpi: introduce NVDIMM_DSM_MEMORY_SIZE 2016-11-15 17:20:37 +02:00
adc STM32F2xx: Add the ADC device 2016-10-04 13:28:07 +01:00
alpha sun4uv: fix serial initialization regression 2016-10-24 15:27:20 +02:00
arm hw/arm/tosa: Fix reset handling 2016-10-28 15:51:27 +01:00
audio audio: intel-hda: check stream entry count during transfer 2016-10-26 14:51:44 +02:00
block virtio, pc: fixes and features 2016-11-03 14:41:53 +00:00
bt char: replace avail_connections 2016-10-24 15:46:10 +02:00
char char: cadence: check baud rate generator and divider values 2016-11-07 10:00:24 +00:00
core qdev: hotplug: drop HotplugHandler.post_plug callback 2016-11-15 17:20:37 +02:00
cpu cpu: Abstract CPU core type 2016-06-17 16:33:48 +10:00
cris cris: Fix broken header guard in hw/cris/boot.h 2016-07-12 16:20:46 +02:00
display Xen 2016/10/28 2016-10-31 12:35:39 +00:00
dma hw/dma/pl080: Fix bad bit mask (PL080_CONF_M1 | PL080_CONF_M1) 2016-10-17 19:22:17 +01:00
gpio i.MX: Fix GPIO ISR register write 2016-10-28 15:51:27 +01:00
i2c hw/i2c/bitbang_i2c: Handle NACKs from devices 2016-11-07 10:01:15 +00:00
i386 nvdimm acpi: rename nvdimm_acpi_hotplug 2016-11-15 17:20:37 +02:00
ide macio: switch over to new byte-aligned DMA helpers 2016-10-27 16:29:13 -04:00
input hw/input/hid: support alternative sysrq/break scancodes for gtk-vnc 2016-11-10 15:29:58 +00:00
intc nvic: set pending status for not active interrupts 2016-11-07 10:00:24 +00:00
ipack ipack: Update e-mail address 2016-05-18 15:04:27 +03:00
ipmi ipmi: Add graceful shutdown handling to the external BMC 2016-11-01 19:21:09 +02:00
isa char: remove init callback 2016-10-24 15:27:20 +02:00
lm32 Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
m68k m68k: change default system clock for m5208evb 2016-10-08 11:25:29 +03:00
mem pc: memhp: enable nvdimm device hotplug 2016-11-01 19:21:09 +02:00
microblaze clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
mips clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
misc milkymist-pfpu: fix potential integer overflow 2016-10-28 18:17:23 +03:00
moxie
net virtio-net: mark VIRTIO_NET_F_GSO as legacy 2016-11-15 17:20:37 +02:00
nvram trivial patches for 2016-10-28 2016-10-31 11:58:30 +00:00
openrisc
pci trace-events: fix first line comment in trace-events 2016-08-12 10:36:01 +01:00
pci-bridge clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
pci-host apb: convert init to realize 2016-07-29 00:07:09 +03:00
pcmcia
ppc Base patches for MTTCG enablement. 2016-10-31 15:29:12 +00:00
s390x virtio: allow per-device-class legacy features 2016-11-15 17:20:36 +02:00
scsi virtio, pc: fixes and features 2016-11-03 14:41:53 +00:00
sd vmstateify ssi-sd 2016-09-22 18:13:08 +01:00
sh4 sh4: fix broken link to documentation 2016-09-15 15:32:22 +03:00
smbios smbios: fix uuid copy 2016-09-29 11:43:22 +08:00
sparc nvram: Rename openbios_firmware_abi.h into sun_nvram.h 2016-10-28 09:36:58 +11:00
sparc64 nvram: Rename openbios_firmware_abi.h into sun_nvram.h 2016-10-28 09:36:58 +11:00
ssi xilinx: fix buffer overflow on realize 2016-10-24 15:27:20 +02:00
timer clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
tpm clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
tricore tricore: remove useless cast 2016-09-15 15:32:22 +03:00
unicore32 clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
usb usbredir: free vm_change_state_handler in usbredir destroy dispatch 2016-11-10 15:29:58 +00:00
vfio vfio: Add support for mmapping sub-page MMIO BARs 2016-10-31 09:53:04 -06:00
virtio virtio: introduce grab/release_ioeventfd to fix vhost 2016-11-18 17:29:25 +02:00
watchdog nmi: remove x86 specific nmi handling 2016-05-23 16:53:46 +02:00
xen hw/xen/xen_pvdev: Include qemu/log.h for qemu_log_vprintf() 2016-11-02 12:26:04 -07:00
xenpv xenpv: Fix qemu_uuid compiling error 2016-09-29 11:43:17 +08:00
xtensa char: remove init callback 2016-10-24 15:27:20 +02:00
Makefile.objs STM32F2xx: Add the ADC device 2016-10-04 13:28:07 +01:00