qemu-e2k/hw
Kevin Wolf 92e2e6a867 virtio: Drop out of coroutine context in virtio_load()
virtio_load() as a whole should run in coroutine context because it
reads from the migration stream and we don't want this to block.

However, it calls virtio_set_features_nocheck() and devices don't
expect their .set_features callback to run in a coroutine and therefore
call functions that may not be called in coroutine context. To fix this,
drop out of coroutine context for calling virtio_set_features_nocheck().

Without this fix, the following crash was reported:

  #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
  #1  0x00007efc738c05d3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
  #2  0x00007efc73873d26 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
  #3  0x00007efc738477f3 in __GI_abort () at abort.c:79
  #4  0x00007efc7384771b in __assert_fail_base (fmt=0x7efc739dbcb8 "", assertion=assertion@entry=0x560aebfbf5cf "!qemu_in_coroutine()",
     file=file@entry=0x560aebfcd2d4 "../block/graph-lock.c", line=line@entry=275, function=function@entry=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:92
  #5  0x00007efc7386ccc6 in __assert_fail (assertion=0x560aebfbf5cf "!qemu_in_coroutine()", file=0x560aebfcd2d4 "../block/graph-lock.c", line=275,
     function=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:101
  #6  0x0000560aebcd8dd6 in bdrv_register_buf ()
  #7  0x0000560aeb97ed97 in ram_block_added.llvm ()
  #8  0x0000560aebb8303f in ram_block_add.llvm ()
  #9  0x0000560aebb834fa in qemu_ram_alloc_internal.llvm ()
  #10 0x0000560aebb2ac98 in vfio_region_mmap ()
  #11 0x0000560aebb3ea0f in vfio_bars_register ()
  #12 0x0000560aebb3c628 in vfio_realize ()
  #13 0x0000560aeb90f0c2 in pci_qdev_realize ()
  #14 0x0000560aebc40305 in device_set_realized ()
  #15 0x0000560aebc48e07 in property_set_bool.llvm ()
  #16 0x0000560aebc46582 in object_property_set ()
  #17 0x0000560aebc4cd58 in object_property_set_qobject ()
  #18 0x0000560aebc46ba7 in object_property_set_bool ()
  #19 0x0000560aeb98b3ca in qdev_device_add_from_qdict ()
  #20 0x0000560aebb1fbaf in virtio_net_set_features ()
  #21 0x0000560aebb46b51 in virtio_set_features_nocheck ()
  #22 0x0000560aebb47107 in virtio_load ()
  #23 0x0000560aeb9ae7ce in vmstate_load_state ()
  #24 0x0000560aeb9d2ee9 in qemu_loadvm_state_main ()
  #25 0x0000560aeb9d45e1 in qemu_loadvm_state ()
  #26 0x0000560aeb9bc32c in process_incoming_migration_co.llvm ()
  #27 0x0000560aebeace56 in coroutine_trampoline.llvm ()

Cc: qemu-stable@nongnu.org
Buglink: https://issues.redhat.com/browse/RHEL-832
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20230905145002.46391-3-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2023-09-08 17:03:09 +02:00
..
9pfs hw/9pfs: spelling fixes 2023-07-25 17:15:47 +03:00
acpi hw/acpi: Fix PM control register access 2023-06-26 09:49:24 -04:00
adc meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
alpha hw/alpha: Use MachineClass->default_nic in the alpha machine 2023-05-26 09:10:49 +02:00
arm hw/sd: Introduce a "sd-card" SPI variant model 2023-09-01 11:40:04 +02:00
audio meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
avr
block m25p80: Introduce an helper to retrieve the BlockBackend of a device 2023-09-01 11:40:04 +02:00
char hw/char/pl011: Replace magic values by register field definitions 2023-08-31 19:47:43 +02:00
core hw: Add compat machines for 8.2 2023-08-23 12:06:39 +02:00
cpu meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
cris
cxl hw/cxl/events: Add event interrupt support 2023-06-22 18:55:14 -04:00
display hw/display: spelling fixes 2023-08-31 19:47:43 +02:00
dma hw/dma/etraxfs: Include missing 'exec/memory.h' header 2023-08-31 19:47:43 +02:00
gpio hw/gpio/nrf51: implement DETECT signal 2023-08-22 17:30:59 +01:00
hppa target/hppa: Provide qemu version via fw_cfg to firmware 2023-06-24 13:39:48 +02:00
hyperv win32: replace closesocket() with close() wrapper 2023-03-13 15:39:31 +04:00
i2c aspeed queue: 2023-09-06 11:14:55 -04:00
i386 hw/i386: Rename 'hw/kvm/clock.h' -> 'hw/i386/kvm/clock.h' 2023-08-31 19:47:43 +02:00
ide hw/ide/ahci: fix broken SError handling 2023-09-06 22:48:04 -04:00
input vhost-user: fully use new backend/frontend naming 2023-06-26 09:50:00 -04:00
intc ppc/xive: Add support for the PC MMIOs 2023-09-06 11:19:33 +02:00
ipack meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
ipmi meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
isa hw/isa/vt82c686: Remove via_isa_set_irq() 2023-07-11 00:11:25 +02:00
loongarch hw/loongarch: Fix ACPI processor id off-by-one error 2023-08-24 16:58:16 +08:00
m68k hw: Add compat machines for 8.2 2023-08-23 12:06:39 +02:00
mem memory-device: Track used region size in DeviceMemoryState 2023-07-12 09:25:37 +02:00
microblaze hw/ssi: Check for duplicate CS indexes 2023-09-01 11:40:04 +02:00
mips hw/mips: spelling fixes 2023-08-31 19:47:43 +02:00
misc Add i.MX7 SRC device implementation 2023-08-31 09:45:17 +01:00
net hw/net/i82596: Include missing 'exec/address-spaces.h' header 2023-08-31 19:47:43 +02:00
nios2
nubus meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
nvme hw/nvme: fix null pointer access in ruh update 2023-08-09 15:32:32 +02:00
nvram hw/nvram: Avoid unnecessary Xilinx eFuse backstore write 2023-07-17 11:05:52 +01:00
openrisc *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
pci pci: Fix the update of interrupt disable bit in PCI_COMMAND register 2023-08-11 12:15:24 -04:00
pci-bridge hw/pci-bridge/cxl_upstream.c: Use g_new0() in build_cdat_table() 2023-08-03 16:06:49 -04:00
pci-host hw/pci-host: Allow extended config space access for Designware PCIe host 2023-08-11 12:15:24 -04:00
pcmcia meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
ppc target/ppc: Fix the order of kvm_enable judgment about kvmppc_set_interrupt() 2023-09-06 11:19:33 +02:00
rdma meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
remote exec/memory: Add symbol for memory listener priority for device backend 2023-06-28 14:27:59 +02:00
riscv hw/sd: Introduce a "sd-card" SPI variant model 2023-09-01 11:40:04 +02:00
rtc hw/rtc/aspeed_rtc: Use 64-bit offset for holding time_t difference 2023-08-31 09:45:18 +01:00
rx bulk: Remove pointless QOM casts 2023-06-05 20:48:34 +02:00
s390x hw/s390x/s390-virtio-ccw: Remove superfluous code to set the NIC model 2023-08-23 12:06:44 +02:00
scsi scsi: clear unit attention only for REPORT LUNS commands 2023-07-14 11:10:58 +02:00
sd aspeed queue: 2023-09-06 11:14:55 -04:00
sensor hw/i2c: spelling fixes 2023-08-31 19:47:43 +02:00
sh4 hw/sh4: Use MachineClass->default_nic in the sh4 r2d machine 2023-05-22 09:44:48 +02:00
smbios hw/smbios: Fix core count in type4 2023-07-10 16:17:08 -04:00
sparc other architectures: spelling fixes 2023-07-25 17:14:07 +03:00
sparc64 hw/pci/pci: Remove multifunction parameter from pci_new_multifunction() 2023-07-10 18:59:32 -04:00
ssi hw/ssi: Check for duplicate CS indexes 2023-09-01 11:40:04 +02:00
timer meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
tpm hw/tpm: TIS on sysbus: Remove unsupport ppi command line option 2023-07-14 11:31:54 -04:00
tricore
usb hw/usb/hcd-xhci: Avoid variable-length array in xhci_get_port_bandwidth() 2023-08-31 19:47:43 +02:00
vfio vfio/pci: Enable AtomicOps completers on root ports 2023-07-10 09:52:52 +02:00
virtio virtio: Drop out of coroutine context in virtio_load() 2023-09-08 17:03:09 +02:00
watchdog meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
xen bulk: Do not declare function prototypes using 'extern' keyword 2023-08-31 19:47:43 +02:00
xenpv hw/xenpv: Initialize Xen backend operations 2023-03-24 14:52:14 +00:00
xtensa target/xtensa: Include missing 'qemu/atomic.h' header 2023-08-31 19:47:43 +02:00
Kconfig xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation 2023-03-01 08:22:49 +00:00
meson.build