From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 3/7] spapr: introduce SpaprMachineClass::numa_assoc_array
Date: Thu, 3 Sep 2020 08:28:00 -0300 [thread overview]
Message-ID: <d493d0d8-7104-40a4-a957-156b6cd1d5b6@gmail.com> (raw)
In-Reply-To: <20200903015148.GK1897@yekko.fritz.box>
On 9/2/20 10:51 PM, David Gibson wrote:
> On Tue, Sep 01, 2020 at 09:56:41AM -0300, Daniel Henrique Barboza wrote:
>> The next step to centralize all NUMA/associativity handling in
>> the spapr machine is to create a 'one stop place' for all
>> things ibm,associativity.
>>
>> This patch introduces numa_assoc_array, a 2 dimensional array
>> that will store all ibm,associativity arrays of all NUMA nodes.
>> This array is initialized in a new spapr_numa_associativity_init()
>> function, called in spapr_machine_init(). It is being initialized
>> with the same values used in other ibm,associativity properties
>> around spapr files (i.e. all zeros, last value is node_id).
>> The idea is to remove all hardcoded definitions and FDT writes
>> of ibm,associativity arrays, doing instead a call to the new
>> helper spapr_numa_write_associativity_dt() helper, that will
>> be able to write the DT with the correct values.
>>
>> We'll start small, handling the trivial cases first. The
>> remaining instances of ibm,associativity will be handled
>> next.
>>
>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
>
> The idea is great, but there's one small but significant problem here:
>
>> +void spapr_numa_associativity_init(MachineState *machine)
>> +{
>> + SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
>> + int nb_numa_nodes = machine->numa_state->num_nodes;
>> + int i;
>> +
>> + /*
>> + * For all associativity arrays: first position is the size,
>> + * position MAX_DISTANCE_REF_POINTS is always the numa_id,
>> + * represented by the index 'i'.
>> + *
>> + * This will break on sparse NUMA setups, when/if QEMU starts
>> + * to support it, because there will be no more guarantee that
>> + * 'i' will be a valid node_id set by the user.
>> + */
>> + for (i = 0; i < nb_numa_nodes; i++) {
>> + smc->numa_assoc_array[i][0] = cpu_to_be32(MAX_DISTANCE_REF_POINTS);
>> + smc->numa_assoc_array[i][MAX_DISTANCE_REF_POINTS] = cpu_to_be32(i);
>
> This initialization is called on a machine *instance*, which means it
> should treat the machine class as read-only. i.e. the
> numa_assoc_array should be in the SpaprMachineState, rather than the
> class.
>
> I mean, we'd get away with it in practice, since there's only ever
> likely to be a single machine instance, but still we should correct
> this.
Got it. I'll move it to SpaprMachineState. This will also spare a handful of lines
everywhere else since I was instantiating the class just to manipulate the matrix
(and now, in hindsight, I figured that this was a warning about the weirdness
of what I was doing).
Thanks,
DHB
>
next prev parent reply other threads:[~2020-09-03 11:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 12:56 [PATCH v2 0/7] pseries NUMA distance rework Daniel Henrique Barboza
2020-09-01 12:56 ` [PATCH v2 1/7] ppc: introducing spapr_numa.c NUMA code helper Daniel Henrique Barboza
2020-09-01 12:56 ` [PATCH v2 2/7] ppc/spapr_nvdimm: turn spapr_dt_nvdimm() static Daniel Henrique Barboza
2020-09-01 12:56 ` [PATCH v2 3/7] spapr: introduce SpaprMachineClass::numa_assoc_array Daniel Henrique Barboza
2020-09-03 1:51 ` David Gibson
2020-09-03 11:28 ` Daniel Henrique Barboza [this message]
2020-09-01 12:56 ` [PATCH v2 4/7] spapr, spapr_numa: handle vcpu ibm,associativity Daniel Henrique Barboza
2020-09-01 12:56 ` [PATCH v2 5/7] spapr, spapr_numa: move lookup-arrays handling to spapr_numa.c Daniel Henrique Barboza
2020-09-03 1:34 ` David Gibson
2020-09-03 11:22 ` Daniel Henrique Barboza
2020-09-01 12:56 ` [PATCH v2 6/7] spapr_numa: move NVLink2 associativity " Daniel Henrique Barboza
2020-09-03 1:56 ` David Gibson
2020-09-03 14:20 ` Daniel Henrique Barboza
2020-09-01 12:56 ` [PATCH v2 7/7] spapr_hcall: h_home_node_associativity now reads numa_assoc_array Daniel Henrique Barboza
2020-09-03 1:46 ` David Gibson
2020-09-03 11:17 ` Daniel Henrique Barboza
2020-09-03 1:35 ` [PATCH v2 0/7] pseries NUMA distance rework David Gibson
2020-09-03 1:49 ` David Gibson
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=d493d0d8-7104-40a4-a957-156b6cd1d5b6@gmail.com \
--to=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--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).