qemu-e2k/hw/ppc
Daniel Henrique Barboza 1fde73bcd7 spapr_numa.c: fix FORM1 distance-less nodes
Commit 71e6fae3a9 fixed an issue with FORM2 affinity guests with NUMA
nodes in which the distance info is absent in
machine_state->numa_state->nodes. This happens when QEMU adds a default
NUMA node and when the user adds NUMA nodes without specifying the
distances.

During the discussions of the forementioned patch [1] it was found that
FORM1 guests were behaving in a strange way in the same scenario, with
the kernel seeing the distances between the nodes as '160', as we can
see in this example with 4 NUMA nodes without distance information:

$ numactl -H
available: 4 nodes (0-3)
(...)
node distances:
node   0   1   2   3
  0:  10  160  160  160
  1:  160  10  160  160
  2:  160  160  10  160
  3:  160  160  160  10

Turns out that we have the same problem with FORM1 guests - we are
calculating associativity domain using zeroed values. And as it also
turns out, the solution from 71e6fae3a9 applies to FORM1 as well.

This patch creates a wrapper called 'get_numa_distance' that contains
the logic used in FORM2 to define node distances when this information
is absent. This helper is then used in all places where we need to read
distance information from machine_state->numa_state->nodes. That way
we'll guarantee that the NUMA node distance is always being curated
before being used.

After this patch, the FORM1 guest mentioned above will have the
following topology:

$ numactl -H
available: 4 nodes (0-3)
(...)
node distances:
node   0   1   2   3
  0:  10  20  20  20
  1:  20  10  20  20
  2:  20  20  10  20
  3:  20  20  20  10

This is compatible with what FORM2 guests and other archs do in this
case.

[1] https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg01960.html

Fixes: 690fbe4295 ("spapr_numa: consider user input when defining associativity")
CC: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
CC: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2021-11-10 13:48:13 +01:00
..
e500-ccsr.h
e500.c qdev: Make DeviceState.id independent of QemuOpts 2021-10-15 16:06:35 +02:00
e500.h
e500plat.c
fdt.c
fw_cfg.c
Kconfig
mac_newworld.c
mac_oldworld.c
mac.h
meson.build
mpc8544_guts.c
mpc8544ds.c
pef.c
pegasos2.c ppc/pegasos2: Suppress warning when qtest enabled 2021-11-09 10:32:52 +11:00
pnv_bmc.c
pnv_core.c
pnv_homer.c
pnv_lpc.c
pnv_occ.c
pnv_pnor.c ppc/pnv: Fix check on block device before updating drive contents 2021-11-09 10:32:52 +11:00
pnv_psi.c
pnv_xscom.c
pnv.c
ppc4xx_devs.c
ppc4xx_pci.c hw/ppc/ppc4xx_pci: Fix ppc4xx_pci_map_irq() for recent Linux kernels 2021-10-21 11:42:47 +11:00
ppc405_boards.c
ppc405_uc.c
ppc405.h
ppc440_bamboo.c
ppc440_pcix.c
ppc440_uc.c
ppc440.h
ppc_booke.c
ppc.c hw/ppc: Fix iothread locking in the 405 code 2021-10-21 11:42:47 +11:00
ppce500_spin.c
prep_systemio.c
prep.c
rs6000_mc.c
sam460ex.c
spapr_caps.c
spapr_cpu_core.c
spapr_drc.c
spapr_events.c
spapr_hcall.c spapr: move FORM1 verifications to post CAS 2021-09-30 12:26:06 +10:00
spapr_iommu.c
spapr_irq.c
spapr_numa.c spapr_numa.c: fix FORM1 distance-less nodes 2021-11-10 13:48:13 +01:00
spapr_nvdimm.c
spapr_ovec.c
spapr_pci_nvlink2.c pci: Export pci_for_each_device_under_bus*() 2021-11-01 19:36:11 -04:00
spapr_pci_vfio.c pci: Export pci_for_each_device_under_bus*() 2021-11-01 19:36:11 -04:00
spapr_pci.c pci: Export pci_for_each_device_under_bus*() 2021-11-01 19:36:11 -04:00
spapr_rng.c
spapr_rtas_ddw.c
spapr_rtas.c
spapr_rtc.c
spapr_softmmu.c hw/ppc/spapr_softmmu: Reduce include list 2021-10-21 11:42:47 +11:00
spapr_tpm_proxy.c
spapr_vio.c qbus: Rename qbus_create() to qbus_new() 2021-09-30 13:44:08 +01:00
spapr_vof.c
spapr.c machine: Move smp_prefer_sockets to struct SMPCompatProps 2021-10-01 15:29:15 +02:00
trace-events target/ppc: Convert debug to trace events (decrementer and IRQ) 2021-09-30 12:26:06 +10:00
trace.h
virtex_ml507.c
vof.c