All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>,
	Gautham R Shenoy <ego@linux.vnet.ibm.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	kernel test robot <lkp@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Geetika Moolchandani <Geetika.Moolchandani1@ibm.com>,
	Valentin Schneider <valentin.schneider@arm.com>,
	Laurent Dufour <ldufour@linux.ibm.com>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH v2 3/3] powerpc/numa: Fill distance_lookup_table for offline nodes
Date: Thu, 23 Sep 2021 21:17:25 +1000	[thread overview]
Message-ID: <871r5fmth6.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20210901102206.GO21942@linux.vnet.ibm.com>

Srikar Dronamraju <srikar@linux.vnet.ibm.com> writes:
> * Michael Ellerman <mpe@ellerman.id.au> [2021-08-26 23:36:53]:
>
>> Srikar Dronamraju <srikar@linux.vnet.ibm.com> writes:
>> > Scheduler expects unique number of node distances to be available at
>> > boot.
...
>
>> > Fake the offline node's distance_lookup_table entries so that all
>> > possible node distances are updated.
>> 
>> Does this work if we have a single node offline at boot?
>> 
>
> It should.
>
>> Say we start with:
>> 
>> node distances:
>> node   0   1
>>   0:  10  20
>>   1:  20  10
>> 
>> And node 2 is offline at boot. We can only initialise that nodes entries
>> in the distance_lookup_table:
>> 
>> 		while (i--)
>> 			distance_lookup_table[node][i] = node;
>> 
>> By filling them all with 2 that causes node_distance(2, X) to return the
>> maximum distance for all other nodes X, because we won't break out of
>> the loop in __node_distance():
>> 
>> 	for (i = 0; i < distance_ref_points_depth; i++) {
>> 		if (distance_lookup_table[a][i] == distance_lookup_table[b][i])
>> 			break;
>> 
>> 		/* Double the distance for each NUMA level */
>> 		distance *= 2;
>> 	}
>> 
>> If distance_ref_points_depth was 4 we'd return 160.
>
> As you already know, distance 10, 20, .. are defined by Powerpc, form1
> affinity. PAPR doesn't define actual distances, it only provides us the
> associativity. If there are distance_ref_points_depth is 4,
> (distance_ref_points_depth doesn't take local distance into consideration)
> 10, 20, 40, 80, 160.
>
>> 
>> That'd leave us with 3 unique distances at boot, 10, 20, 160.
>> 
>
> So if there are unique distances, then the distances as per the current
> code has to be 10, 20, 40, 80.. I dont see a way in which we have a break in
> the series. like having 160 without 80.

I'm confused what you mean there.

If we have a node that's offline at boot then we get 160 for that node,
that's just the result of having no info for it, so we never break out
of the for loop.

So if we have two nodes, one hop apart, and then an offline node we get
10, 20, 160.

Or if you're using depth = 3 then it's 10, 20, 80.

>> But when node 2 comes online it might introduce more than 1 new distance
>> value, eg. it could be that the actual distances are:
>> 
>> node distances:
>> node   0   1   2
>>   0:  10  20  40
>>   1:  20  10  80
>>   2:  40  80  10
>> 
>> ie. we now have 4 distances, 10, 20, 40, 80.
>> 
>> What am I missing?
>
> As I said above, I am not sure how we can have a break in the series.
> If distance_ref_points_depth is 3, the distances has to be 10,20,40,80 as
> atleast for form1 affinity.

I agree for depth 3 we have to see 10, 20, 40, 80. But nothing
guarantees we see each value (other than 10).

We can have two nodes one hop apart, so we have 10 and 20, then a third
node is added 3 hops away, so we get 10, 20, 80.

The real problem is that the third node could be 3 hops from node 0
and 2 hops from node 1, and so the addition of the third node causes
two new distance values (40 & 80) to be required.

I think maybe what you're saying is that in practice we don't see setups
like that. But I don't know if I'm happy with a solution that doesn't
work in the general case, and relies on the particular properties of our
current set of systems.

Possibly we just need to detect that case and WARN about it. The only
problem is we won't know until the system is already up and running, ie.
we can't know at boot that the onlining of the third node will cause 2
new distance values to be added.

cheers

  reply	other threads:[~2021-09-23 11:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21 10:25 [PATCH v2 0/3] Updates to powerpc for robust CPU online/offline Srikar Dronamraju
2021-08-21 10:25 ` [PATCH v2 1/3] powerpc/numa: Print debug statements only when required Srikar Dronamraju
2021-08-23  9:21   ` Laurent Dufour
2021-08-23  9:38     ` Srikar Dronamraju
2021-08-25 13:01       ` Michael Ellerman
2021-08-26  4:47         ` Srikar Dronamraju
2021-08-21 10:25 ` [PATCH v2 2/3] powerpc/numa: Update cpu_cpu_map on CPU online/offline Srikar Dronamraju
2021-08-21 10:25 ` [PATCH v2 3/3] powerpc/numa: Fill distance_lookup_table for offline nodes Srikar Dronamraju
2021-08-26 13:36   ` Michael Ellerman
2021-09-01 10:22     ` Srikar Dronamraju
2021-09-23 11:17       ` Michael Ellerman [this message]
2021-09-23 17:57         ` Srikar Dronamraju
2021-10-11 11:45           ` Michael Ellerman
2021-08-23  8:33 ` [PATCH v2 0/3] Updates to powerpc for robust CPU online/offline Peter Zijlstra
2021-08-23  9:34   ` Srikar Dronamraju
2021-08-23  9:37     ` Peter Zijlstra

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=871r5fmth6.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=Geetika.Moolchandani1@ibm.com \
    --cc=ego@linux.vnet.ibm.com \
    --cc=ldufour@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lkp@intel.com \
    --cc=mingo@kernel.org \
    --cc=nathanl@linux.ibm.com \
    --cc=peterz@infradead.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.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 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.