spapr: Correct inverted test in spapr_pc_dimm_node()
PATCH 1/1 spapr: Correct inverted test in spapr_pc_dimm_node()
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.
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
@@ -665,7 +665,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; }
Signature · 1 line
2.17.1
Quoted 11 lines · On Tue, 10 Jul 2018 11:52:57 +1000 David Gibson <[email protected]>…
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 <[email protected]>---
Quoted 16 lines
hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -665,7 +665,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; }
Quoted 19 lines · On Tue, 10 Jul 2018 11:52:57 +1000 David Gibson <[email protected]>…
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 <[email protected]>--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +0
-0
hw/ppc/spapr.c static uint32_t spapr_pc_dimm_node(MemoryDeviceInfoList *list, ram_addr_t addr) · line 671
Quoted 8 lines
hw/ppc/spapr.c +1
-1@@ -665,7 +665,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; }