qemu-e2k/hw
Daniel Henrique Barboza d1c2e3ce3d spapr_drc.c: add hotunplug timeout for CPUs
There is a reliable way to make a CPU hotunplug fail in the pseries
machine. Hotplug a CPU A, then offline all other CPUs inside the guest
but A. When trying to hotunplug A the guest kernel will refuse to do it,
because A is now the last online CPU of the guest. PAPR has no 'error
callback' in this situation to report back to the platform, so the guest
kernel will deny the unplug in silent and QEMU will never know what
happened. The unplug pending state of A will remain until the guest is
shutdown or rebooted.

Previous attempts of fixing it (see [1] and [2]) were aimed at trying to
mitigate the effects of the problem. In [1] we were trying to guess
which guest CPUs were online to forbid hotunplug of the last online CPU
in the QEMU layer, avoiding the scenario described above because QEMU is
now failing in behalf of the guest. This is not robust because the last
online CPU of the guest can change while we're in the middle of the
unplug process, and our initial assumptions are now invalid. In [2] we
were accepting that our unplug process is uncertain and the user should
be allowed to spam the IRQ hotunplug queue of the guest in case the CPU
hotunplug fails.

This patch presents another alternative, using the timeout
infrastructure introduced in the previous patch. CPU hotunplugs in the
pSeries machine will now timeout after 15 seconds. This is a long time
for a single CPU unplug to occur, regardless of guest load - although
the user is *strongly* encouraged to *not* hotunplug devices from a
guest under high load - and we can be sure that something went wrong if
it takes longer than that for the guest to release the CPU (the same
can't be said about memory hotunplug - more on that in the next patch).

Timing out the unplug operation will reset the unplug state of the CPU
and allow the user to try it again, regardless of the error situation
that prevented the hotunplug to occur. Of all the not so pretty
fixes/mitigations for CPU hotunplug errors in pSeries, timing out the
operation is an admission that we have no control in the process, and
must assume the worst case if the operation doesn't succeed in a
sensible time frame.

[1] https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg03353.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg04400.html

Reported-by: Xujun Ma <xuma@redhat.com>
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1911414
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20210222194531.62717-5-danielhb413@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-03-10 09:07:09 +11:00
..
9pfs
acpi acpi/core: always set SCI_EN when SMM isn't supported 2021-02-23 10:58:42 -05:00
adc
alpha
arm hw/arm/mps2: Update old infocenter.arm.com URLs 2021-03-08 11:54:16 +00:00
audio
avr
block hw/block: Introduce TC58128 eeprom Kconfig entry 2021-03-06 16:18:42 +01:00
char hw/char: Introduce SH_SCI Kconfig entry 2021-03-06 16:18:42 +01:00
core acpi/core: always set SCI_EN when SMM isn't supported 2021-02-23 10:58:42 -05:00
cpu
cris
display hw/display/sm501: Inline template header into C file 2021-03-10 09:07:08 +11:00
dma esp: rename existing ESP QOM type to SYSBUS_ESP 2021-03-07 10:39:05 +00:00
gpio
hppa
hyperv
i2c hw/i2c/npcm7xx_smbus: Simplify npcm7xx_smbus_init() 2021-03-05 15:17:34 +00:00
i386 x86/pvh: extract only 4 bytes of start address for 32 bit kernels 2021-03-06 11:41:54 +01:00
ide hw/ide/ahci: map cmd_fis as DMA_DIRECTION_TO_DEVICE 2021-02-15 15:10:14 +01:00
input
intc Renesas patches queue 2021-03-08 15:45:48 +00:00
ipack
ipmi
isa acpi/core: always set SCI_EN when SMM isn't supported 2021-02-23 10:58:42 -05:00
lm32
m68k esp: rename existing ESP QOM type to SYSBUS_ESP 2021-03-07 10:39:05 +00:00
mem nvdimm: put it into the 'storage' category 2021-02-20 12:36:19 +01:00
microblaze
mips esp: rename existing ESP QOM type to SYSBUS_ESP 2021-03-07 10:39:05 +00:00
misc hw/arm/mps2: Update old infocenter.arm.com URLs 2021-03-08 11:54:16 +00:00
moxie
net hw/net: Add npcm7xx emc model 2021-03-05 15:17:34 +00:00
nios2
nubus
nvram
openrisc
pci hw/pci: Have safer pcie_bus_realize() by checking error path 2021-03-02 09:16:18 -05:00
pci-bridge
pci-host hw/pci-host: Introduce SH_PCI Kconfig entry 2021-03-06 16:18:42 +01:00
pcmcia
ppc spapr_drc.c: add hotunplug timeout for CPUs 2021-03-10 09:07:09 +11:00
rdma
remote
riscv hw/riscv: virt: Map high mmio for PCIe 2021-03-04 09:43:29 -05:00
rtc goldfish_rtc: re-arm the alarm after migration 2021-03-04 09:43:29 -05:00
rx
s390x virtio-ccw: commands on revision-less devices 2021-03-04 11:23:35 +01:00
scsi qemu-sparc queue 2021-03-09 13:50:35 +00:00
sd Pull request trivial patches 20210220 2021-02-21 12:12:18 +00:00
semihosting
sh4 hw/sh4/sh7750_regs: Replace link to license by its full content 2021-03-06 16:19:03 +01:00
smbios
sparc esp: rename existing ESP QOM type to SYSBUS_ESP 2021-03-07 10:39:05 +00:00
sparc64
ssi hw/ssi: Add SiFive SPI controller support 2021-03-04 09:43:29 -05:00
timer hw/timer: Introduce SH_TIMER Kconfig entry 2021-03-06 16:18:42 +01:00
tpm tpm: put some tpm devices into the correct category 2021-02-20 12:36:19 +01:00
tricore
unicore32
usb scsi: drop 'result' argument from command_complete callback 2021-02-25 14:14:32 +01:00
vfio vfio-ccw: Do not read region ret_code after write 2021-03-04 11:24:49 +01:00
virtio virtio-mmio: improve virtio-mmio get_dev_path alog 2021-03-05 15:17:34 +00:00
watchdog
xen
xenpv
xtensa
Kconfig
meson.build