All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr: Correct inverted test in spapr_pc_dimm_node()
@ 2018-07-10  1:52 David Gibson
  2018-07-10  7:33 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
  2018-07-10  8:08 ` [Qemu-devel] " Igor Mammedov
  0 siblings, 2 replies; 3+ messages in thread
From: David Gibson @ 2018-07-10  1:52 UTC (permalink / raw)
  To: imammedo; +Cc: ehabkost, qemu-ppc, qemu-devel, 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 <david@gibson.dropbear.id.au>
---
 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 3f5e1d3ec2..421b2dd09b 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -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;
             }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr: Correct inverted test in spapr_pc_dimm_node()
  2018-07-10  1:52 [Qemu-devel] [PATCH] spapr: Correct inverted test in spapr_pc_dimm_node() David Gibson
@ 2018-07-10  7:33 ` Greg Kurz
  2018-07-10  8:08 ` [Qemu-devel] " Igor Mammedov
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kurz @ 2018-07-10  7:33 UTC (permalink / raw)
  To: David Gibson; +Cc: imammedo, qemu-ppc, ehabkost, qemu-devel

On Tue, 10 Jul 2018 11:52:57 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:

> 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 <david@gibson.dropbear.id.au>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  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 3f5e1d3ec2..421b2dd09b 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -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;
>              }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr: Correct inverted test in spapr_pc_dimm_node()
  2018-07-10  1:52 [Qemu-devel] [PATCH] spapr: Correct inverted test in spapr_pc_dimm_node() David Gibson
  2018-07-10  7:33 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
@ 2018-07-10  8:08 ` Igor Mammedov
  1 sibling, 0 replies; 3+ messages in thread
From: Igor Mammedov @ 2018-07-10  8:08 UTC (permalink / raw)
  To: David Gibson; +Cc: ehabkost, qemu-ppc, qemu-devel

On Tue, 10 Jul 2018 11:52:57 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:

> 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 <david@gibson.dropbear.id.au>
> ---
>  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 3f5e1d3ec2..421b2dd09b 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -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;
>              }

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-10  8:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10  1:52 [Qemu-devel] [PATCH] spapr: Correct inverted test in spapr_pc_dimm_node() David Gibson
2018-07-10  7:33 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2018-07-10  8:08 ` [Qemu-devel] " Igor Mammedov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.