From: David Gibson <david@gibson.dropbear.id.au>
To: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 7/7] spapr_hcall: h_home_node_associativity now reads numa_assoc_array
Date: Thu, 3 Sep 2020 11:46:45 +1000 [thread overview]
Message-ID: <20200903014645.GI1897@yekko.fritz.box> (raw)
In-Reply-To: <20200901125645.118026-8-danielhb413@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3459 bytes --]
On Tue, Sep 01, 2020 at 09:56:45AM -0300, Daniel Henrique Barboza wrote:
> home_node_associativity reply now uses the associativity
> values for tcpu->node_id provided by numa_assoc_array.
>
> This will avoid further changes in this code when numa_assoc_array
> changes values, but it won't be enough to prevent further changes
> if (falar aqui q se mudar o tamanho do array tem q mexer nessa
> funcao tambem, falar q a macro associativity() deixa a automacao
> de tudo mto unreadable)
Uh.. I'm guessing that was a note to yourself you intended to
translate before publishing?
>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
> hw/ppc/spapr_hcall.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index c1d01228c6..2ec30efdcb 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -1878,9 +1878,13 @@ static target_ulong h_home_node_associativity(PowerPCCPU *cpu,
> target_ulong opcode,
> target_ulong *args)
You could move this function to spapr_numa.c as well (the name's a bit
misleading, but spapr_hcall.c isn't really intended to hold *all*
hcall implementations, just the ones that don't have somewhere better
to live).
> {
> + SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
> target_ulong flags = args[0];
> target_ulong procno = args[1];
> PowerPCCPU *tcpu;
> + uint32_t assoc_domain1;
> + uint32_t assoc_domain2;
> + uint32_t assoc_domain3;
> int idx;
>
> /* only support procno from H_REGISTER_VPA */
> @@ -1893,13 +1897,21 @@ static target_ulong h_home_node_associativity(PowerPCCPU *cpu,
> return H_P2;
> }
>
> + /*
> + * Index 0 is the ibm,associativity size of the node,
> + * which isn't relevant here.
> + */
> + assoc_domain1 = smc->numa_assoc_array[tcpu->node_id][1];
> + assoc_domain2 = smc->numa_assoc_array[tcpu->node_id][2];
> + assoc_domain3 = smc->numa_assoc_array[tcpu->node_id][3];
Using all these temporaries is a little ugly. Maybe do something like:
uint32_t *assoc = smc->numa_assoc_array[tcpu->node_id];
Then just use assoc[1], assoc[2] etc. below.
> +
> /* sequence is the same as in the "ibm,associativity" property */
>
> idx = 0;
> #define ASSOCIATIVITY(a, b) (((uint64_t)(a) << 32) | \
> ((uint64_t)(b) & 0xffffffff))
> - args[idx++] = ASSOCIATIVITY(0, 0);
> - args[idx++] = ASSOCIATIVITY(0, tcpu->node_id);
> + args[idx++] = ASSOCIATIVITY(assoc_domain1, assoc_domain2);
> + args[idx++] = ASSOCIATIVITY(assoc_domain3, tcpu->node_id);
> args[idx++] = ASSOCIATIVITY(procno, -1);
> for ( ; idx < 6; idx++) {
> args[idx] = -1;
Better yet would be to make this handle an arbitrary length of assoc
array, further isolating this from the specifics of how we construct
the arrays. Ideally, you'd call a common path with
spapr_numa_fixup_cpu_dt() to get the assoc array for a cpu, then here
just translate it into the in-register format the hcall expects.
--
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 --]
next prev parent reply other threads:[~2020-09-03 1:57 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
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 [this message]
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=20200903014645.GI1897@yekko.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=danielhb413@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 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.