qemu-patch-raspberry4/include/hw
Daniel Henrique Barboza fe1831eff8 spapr_drc.c: use DRC reconfiguration to cleanup DIMM unplug state
Handling errors in memory hotunplug in the pSeries machine is more
complex than any other device type, because there are all the
complications that other devices has, and more.

For instance, determining a timeout for a DIMM hotunplug must consider
if it's a Hash-MMU or a Radix-MMU guest, because Hash guests takes
longer to hotunplug DIMMs. The size of the DIMM is also a factor, given
that longer DIMMs naturally takes longer to be hotunplugged from the
kernel. And there's also the guest memory usage to be considered: if
there's a process that is consuming memory that would be lost by the
DIMM unplug, the kernel will postpone the unplug process until the
process finishes, and then initiate the regular hotunplug process. The
first two considerations are manageable, but the last one is a deal
breaker.

There is no sane way for the pSeries machine to determine the memory
load in the guest when attempting a DIMM hotunplug - and even if there
was a way, the guest can start using all the RAM in the middle of the
unplug process and invalidate our previous assumptions - and in result
we can't even begin to calculate a timeout for the operation. This means
that we can't implement a viable timeout mechanism for memory unplug in
pSeries.

Going back to why we would consider an unplug timeout, the reason is
that we can't know if the kernel is giving up the unplug. Turns out
that, sometimes, we can. Consider a failed memory hotunplug attempt
where the kernel will error out with the following message:

'pseries-hotplug-mem: Memory indexed-count-remove failed, adding any
removed LMBs'

This happens when there is a LMB that the kernel gave up in removing,
and the LMBs previously marked for removal are now being added back.
This happens in the pseries kernel in [1], dlpar_memory_remove_by_ic()
into dlpar_add_lmb(), and after that update_lmb_associativity_index().
In this function, the kernel is configuring the LMB DRC connector again.
Note that this is a valid usage in LOPAR, as stated in section
"ibm,configure-connector RTAS Call":

'A subsequent sequence of calls to ibm,configure-connector with the same
entry from the “ibm,drc-indexes” or “ibm,drc-info” property will restart
the configuration of devices which were not completely configured.'

We can use this kernel behavior in our favor. If a DRC connector
reconfiguration for a LMB that we marked as unplug pending happens, this
indicates that the kernel changed its mind about the unplug and is
reasserting that it will keep using all the LMBs of the DIMM. In this
case, it's safe to assume that the whole DIMM device unplug was
cancelled.

This patch hops into rtas_ibm_configure_connector() and, in the scenario
described above, clear the unplug state for the DIMM device. This will
not solve all the problems we still have with memory unplug, but it will
cover this case where the kernel reconfigures LMBs after a failed
unplug. We are a bit more resilient, without using an unreliable
timeout, and we didn't make the remaining error cases any worse.

[1] arch/powerpc/platforms/pseries/hotplug-memory.c

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20210222194531.62717-6-danielhb413@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-03-10 09:07:09 +11:00
..
acpi acpi/core: always set SCI_EN when SMM isn't supported 2021-02-23 10:58:42 -05:00
adc hw/adc: Add an ADC module for NPCM7XX 2021-01-12 21:19:02 +00:00
arm hw/arm/mps2: Update old infocenter.arm.com URLs 2021-03-08 11:54:16 +00:00
audio qom: Put name parameter before value / visitor parameter 2020-07-10 15:18:08 +02:00
block qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
char hw/char/pl011: add a clock input 2020-10-27 11:10:44 +00:00
core accel/tcg: Precompute curr_cflags into cpu->tcg_cflags 2021-03-06 11:53:57 -08:00
cpu Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
cris sysbus: Convert to sysbus_realize() etc. with Coccinelle 2020-06-15 22:05:28 +02:00
display Clean up includes 2020-12-10 17:16:44 +01:00
dma arm: Update infocenter.arm.com URLs 2021-02-11 11:50:14 +00:00
firmware machine: Refactor smp-related call chains to pass MachineState 2019-07-05 17:07:36 -03:00
gpio hw/gpio: Add GPIO model for Nuvoton NPCM7xx 2020-10-27 11:10:32 +00:00
hyperv Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
i2c hw/i2c: Implement NPCM7XX SMBus Module FIFO Mode 2021-02-16 14:12:54 +00:00
i386 i386/acpi: restore device paths for pre-5.1 vms 2021-03-02 05:40:35 -05:00
ide nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
input input: tsc2xxx fix. 2020-09-22 21:11:10 +01:00
intc hw/ppc: Remove unused ppcuic_init() 2021-01-19 10:20:29 +11:00
ipack Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
ipmi Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
isa vt82c686: Make vt82c686b-pm an abstract base class and add vt8231-pm based on it 2021-02-21 19:42:34 +01:00
kvm target/i386: always create kvmclock device 2020-09-30 19:11:36 +02:00
lm32 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
m68k hw/m68k/next-cube: Add missing header comment to next-cube.h 2021-01-19 09:11:52 +01:00
mem acpi: Permit OEM ID and OEM table ID fields to be changed 2021-02-05 08:52:59 -05:00
mips hw/mips: Add a bootloader helper 2021-02-21 18:41:04 +01:00
misc hw/arm/mps2: Update old infocenter.arm.com URLs 2021-03-08 11:54:16 +00:00
net hw/net: Add npcm7xx emc model 2021-03-05 15:17:34 +00:00
nubus Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
nvram fw_cfg: Refactor extra pci roots addition 2020-12-08 13:48:57 -05:00
pci vt82c686: Make vt82c686b-pm an abstract base class and add vt8231-pm based on it 2021-02-21 19:42:34 +01:00
pci-bridge Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
pci-host Pull request 2021-02-10 15:42:20 +00:00
ppc spapr_drc.c: use DRC reconfiguration to cleanup DIMM unplug state 2021-03-10 09:07:09 +11:00
rdma Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
remote multi-process: perform device reset in the remote process 2021-02-10 09:23:28 +00:00
riscv hw/riscv: sifive_u: Change SIFIVE_U_GEM_IRQ to decimal value 2021-03-04 09:43:29 -05:00
rtc m48t59: remove legacy m48t59_init() function 2020-10-18 16:21:42 +01:00
rx Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
s390x s390: Recognize confidential-guest-support option 2021-02-08 16:57:38 +11: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 semihosting: Fix Lesser GPL version number 2020-11-15 16:38:03 +01:00
sh4 hw/sh4: Add missing license 2021-03-06 16:18:42 +01:00
southbridge Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
sparc include/hw/sparc/grlib.h: Remove unused set_pil_in_fn typedef 2021-01-06 11:41:37 +00:00
ssi hw/ssi: Add SiFive SPI controller support 2021-03-04 09:43:29 -05:00
timer arm: Remove frq properties on CMSDK timer, dualtimer, watchdog, ARMSSE 2021-01-29 15:54:44 +00:00
tricore Include hw/irq.h a lot less 2019-08-16 13:31:52 +02:00
unicore32 hw/unicore32: restrict hw addr defines to source file 2017-12-18 17:07:02 +03:00
usb usb: xlnx-usb-subsystem: Add xilinx usb subsystem 2020-12-15 12:04:30 +00:00
vfio vfio: Change default dirty pages tracking behavior during migration 2020-11-23 10:05:58 -07:00
virtio display/ui: add a callback to indicate GL state is flushed 2021-02-04 15:58:54 +01:00
watchdog arm: Remove frq properties on CMSDK timer, dualtimer, watchdog, ARMSSE 2021-01-29 15:54:44 +00:00
xen xen: remove GNUC check 2020-12-15 12:53:13 -05:00
xtensa Include hw/irq.h a lot less 2019-08-16 13:31:52 +02:00
boards.h confidential guest support: Rework the "memory-encryption" property 2021-02-08 16:57:38 +11:00
clock.h clock: Add new clock_has_source() function 2021-01-29 15:54:42 +00:00
elf_ops.h elf_ops: correct loading of 32 bit PVH kernel 2021-03-06 11:41:54 +01:00
fw-path-provider.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
hotplug.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
hw.h Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
ide.h hw/ide: Move MAX_IDE_DEVS define to hw/ide/internal.h 2020-03-17 12:22:36 -04:00
irq.h include/hw/irq.h: New function qemu_irq_is_connected() 2020-08-03 17:55:03 +01:00
loader-fit.h nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
loader.h hw/core/loader: Let load_elf() populate a field with CPU-specific flags 2020-01-29 19:28:52 +01:00
nmi.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
or-irq.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
pcmcia.h Use OBJECT_DECLARE_TYPE when possible 2020-09-18 14:12:32 -04:00
platform-bus.h nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
ptimer.h ptimer: Add new ptimer_set_period_from_clock() function 2021-01-29 15:54:42 +00:00
qdev-clock.h hw/qdev-clock: Avoid calling qdev_connect_clock_in after DeviceRealize 2020-08-28 10:02:46 +01:00
qdev-core.h machine: introduce MachineInitPhase 2020-12-15 12:51:52 -05:00
qdev-dma.h Supply missing header guards 2019-06-12 13:20:21 +02:00
qdev-properties-system.h qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros 2020-12-18 15:20:17 -05:00
qdev-properties.h qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr() 2020-12-18 15:20:18 -05:00
register.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
registerfields.h hw/registerfields: Prefix local variables with underscore in macros 2020-05-27 11:23:07 -07:00
resettable.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
stream.h hw/core/stream: Rename StreamSlave as StreamSink 2020-12-10 12:15:04 -05:00
sysbus.h qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
usb.h usb: add pcap support. 2021-01-22 14:51:35 +01:00
vmstate-if.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00