qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Nicholas Piggin <npiggin@gmail.com>
Subject: Re: [PATCH] spapr_numa.c: FORM2 table handle nodes with no distance info
Date: Mon, 8 Nov 2021 14:26:47 +1100	[thread overview]
Message-ID: <YYiY98VGqqLRxf5N@yekko> (raw)
In-Reply-To: <555804ca-e59e-6dfb-c133-0087b7c0ffd0@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3735 bytes --]

On Fri, Nov 05, 2021 at 03:52:13PM -0300, Daniel Henrique Barboza wrote:
> 
> 
> On 11/5/21 10:51, Nicholas Piggin wrote:
> > A configuration that specifies multiple nodes without distance info
> > results in the non-local points in the FORM2 matrix having a distance of
> > 0. This causes Linux to complain "Invalid distance value range" because
> > a node distance is smaller than the local distance.
> > 
> > Fix this by building a simple local / remote fallback for points where
> > distance information is missing.
> 
> Thanks for looking this up. I checked the output of this same scenario with
> a FORM1 guest and 4 distance-less NUMA nodes. This is what I got:
> 
> [root@localhost ~]# 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
> [root@localhost ~]#
> 
> 
> With this patch we're getting '20' instead of '160' because you're using
> NUMA_DISTANCE_DEFAULT, while FORM1 will default this case to the maximum
> NUMA distance the kernel allows for that affinity (160).
> 
> I do not have strong feelings about changing this behavior between FORM1 and
> FORM2. I tested the same scenario with a x86_64 guest and they also uses '20'
> in this case as well, so far as QEMU goes using NUMA_DISTANCE_DEFAULT is
> consistent.
> 
> Aneesh is already in CC, so I believe he'll let us know if there's something
> we're missing and we need to preserve the '160' distance in FORM2 for this
> case as well.
> 
> For now:
> 
> 
> > 
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> 
> 
> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

Applied to ppc-for-6.2, thanks.

> 
> 
> 
> >   hw/ppc/spapr_numa.c | 22 +++++++++++++++++-----
> >   1 file changed, 17 insertions(+), 5 deletions(-)
> > 
> > diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c
> > index 5822938448..56ab2a5fb6 100644
> > --- a/hw/ppc/spapr_numa.c
> > +++ b/hw/ppc/spapr_numa.c
> > @@ -546,12 +546,24 @@ static void spapr_numa_FORM2_write_rtas_tables(SpaprMachineState *spapr,
> >                * NUMA nodes, but QEMU adds the default NUMA node without
> >                * adding the numa_info to retrieve distance info from.
> >                */
> > -            if (src == dst) {
> > -                distance_table[i++] = NUMA_DISTANCE_MIN;
> > -                continue;
> > +            distance_table[i] = numa_info[src].distance[dst];
> > +            if (distance_table[i] == 0) {
> > +                /*
> > +                 * In case QEMU adds a default NUMA single node when the user
> > +                 * did not add any, or where the user did not supply distances,
> > +                 * the value will be 0 here. Populate the table with a fallback
> > +                 * simple local / remote distance.
> > +                 */
> > +                if (src == dst) {
> > +                    distance_table[i] = NUMA_DISTANCE_MIN;
> > +                } else {
> > +                    distance_table[i] = numa_info[src].distance[dst];
> > +                    if (distance_table[i] < NUMA_DISTANCE_MIN) {
> > +                        distance_table[i] = NUMA_DISTANCE_DEFAULT;
> > +                    }
> > +                }
> >               }
> > -
> > -            distance_table[i++] = numa_info[src].distance[dst];
> > +            i++;
> >           }
> >       }
> > 
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-11-08  5:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 13:51 [PATCH] spapr_numa.c: FORM2 table handle nodes with no distance info Nicholas Piggin
2021-11-05 18:52 ` Daniel Henrique Barboza
2021-11-08  3:26   ` David Gibson [this message]
2021-11-08  4:22   ` Aneesh Kumar K.V
2021-11-08 13:51     ` Nicholas Piggin
2021-11-08 21:12     ` Daniel Henrique Barboza

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YYiY98VGqqLRxf5N@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=danielhb413@gmail.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).