public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman•id.au>
To: Oliver O'Halloran <oohall@gmail•com>, linuxppc-dev@lists•ozlabs.org
Cc: Oliver O'Halloran <oohall@gmail•com>
Subject: Re: [PATCH 1/5] powerpc/smp: use cpu_to_chip_id() to find siblings
Date: Wed, 15 Mar 2017 22:18:22 +1100	[thread overview]
Message-ID: <877f3qlrep.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <20170302004920.21948-1-oohall@gmail.com>

Oliver O'Halloran <oohall@gmail•com> writes:

> To determine which logical CPUs are on the same core the kernel uses the
> ibm,chipid property from the device tree node associated with that cpu.
> The lookup for this this information is currently open coded in both
> traverse_siblings() and traverse_siblings_chip_id(). This patch replaces
> these manual lookups with the existing cpu_to_chip_id() function.

Some minor nits.

cpu_to_chip_id() actually searches recursively up the parents until it
finds a ibm,chip-id, so it's not a 1:1 replacement for the existing
logic, but it's probably still an OK conversion. It's still worth
mentioning in the change log thought.

> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 893bd7f79be6..dfe0e1d9cd06 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -664,23 +655,19 @@ static void traverse_core_siblings(int cpu, bool add)
>  {
>  	struct device_node *l2_cache, *np;
>  	const struct cpumask *mask;
> -	int i, chip, plen;
> -	const __be32 *prop;
> +	int chip_id;
> +	int i;
>  
> -	/* First see if we have ibm,chip-id properties in cpu nodes */
> -	np = of_get_cpu_node(cpu, NULL);
> -	if (np) {
> -		chip = -1;
> -		prop = of_get_property(np, "ibm,chip-id", &plen);
> -		if (prop && plen == sizeof(int))
> -			chip = of_read_number(prop, 1);
> -		of_node_put(np);
> -		if (chip >= 0) {
> -			traverse_siblings_chip_id(cpu, add, chip);
> -			return;
> -		}
> +	/* threads that share a chip-id are considered siblings (same die) */

You might know it means the "same die", but AFAIK there's no actual
definition for what the chip-id means, so let's not write comments that
might be wrong in future. Just saying they're considered siblings is
sufficient.

Also "Threads" :)

cheers

  parent reply	other threads:[~2017-03-15 11:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02  0:49 [PATCH 1/5] powerpc/smp: use cpu_to_chip_id() to find siblings Oliver O'Halloran
2017-03-02  0:49 ` [PATCH 2/5] powerpc/smp: add set_cpus_related() Oliver O'Halloran
2017-03-15 11:18   ` Michael Ellerman
2017-03-23  1:27     ` Oliver O'Halloran
2017-03-28  1:15       ` Michael Ellerman
2017-03-02  0:49 ` [PATCH 3/5] powerpc/smp: Add update_cpu_masks() Oliver O'Halloran
2017-03-15 11:18   ` Michael Ellerman
2017-03-02  0:49 ` [PATCH 4/5] powerpc/smp: add cpu_cache_mask Oliver O'Halloran
2017-03-15 11:26   ` Michael Ellerman
2017-03-23  3:33     ` Oliver O'Halloran
2017-03-28  1:05       ` Michael Ellerman
2017-03-02  0:49 ` [PATCH 5/5] powerpc/smp: Add Power9 scheduler topology Oliver O'Halloran
2017-03-02 10:25   ` Balbir Singh
2017-03-15 11:33     ` Michael Ellerman
2017-03-15 11:30   ` Michael Ellerman
2017-03-02  3:44 ` [PATCH 1/5] powerpc/smp: use cpu_to_chip_id() to find siblings Balbir Singh
2017-03-15 11:18 ` Michael Ellerman [this message]
2017-03-23  1:09   ` Oliver O'Halloran
2017-03-28  3:03     ` Michael Ellerman
2017-03-28  3:23       ` Oliver O'Halloran

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=877f3qlrep.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman$(echo .)id.au \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=oohall@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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