From c279e652b149621847ef38f08254569632f7ee3b Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 25 Jul 2018 07:23:41 +0100 Subject: [PATCH 01/14] spapr: Correct inverted test in spapr_pc_dimm_node() RH-Author: David Gibson Message-id: <20180725072341.8452-1-dgibson@redhat.com> Patchwork-id: 81498 O-Subject: [RHEL-8.0 qemu-kvm PATCH] spapr: Correct inverted test in spapr_pc_dimm_node() Bugzilla: 1601671 RH-Acked-by: Thomas Huth RH-Acked-by: Laurent Vivier RH-Acked-by: Serhii Popovych From: David Gibson This function was introduced between v2.11 and v2.12 to replace obsolete ways of specifying the NUMA nodes for DIMMs. It's used to find the correct node for an LMB, by locating which DIMM object it lies within. Unfortunately, one of the checks is inverted, so we check whether the address is less than two different things, rather than actually checking a range. This introduced a regression, meaning that after a reboot qemu will advertise incorrect node information for memory to the guest. Signed-off-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Igor Mammedov (cherry picked from commit ccc2cef8b3f1dedd059924eb8ec1a87eff8ef607) Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1601671 Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=17345816 Signed-off-by: David Gibson Signed-off-by: Danilo C. L. de Paula --- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index ef00937..7de3f07 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -659,7 +659,7 @@ static uint32_t spapr_pc_dimm_node(MemoryDeviceInfoList *list, ram_addr_t addr) if (value && value->type == MEMORY_DEVICE_INFO_KIND_DIMM) { PCDIMMDeviceInfo *pcdimm_info = value->u.dimm.data; - if (pcdimm_info->addr >= addr && + if (addr >= pcdimm_info->addr && addr < (pcdimm_info->addr + pcdimm_info->size)) { return pcdimm_info->node; } -- 1.8.3.1