All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gautham R Shenoy <ego@linux.vnet.ibm.com>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>,
	Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v4] powerpc/smp: Use nid as fallback for package_id
Date: Thu, 30 Jan 2020 16:27:47 +0530	[thread overview]
Message-ID: <20200130105747.GD1988@in.ibm.com> (raw)
In-Reply-To: <20200129135121.24617-1-srikar@linux.vnet.ibm.com>

Hello Srikar,



On Wed, Jan 29, 2020 at 07:21:21PM +0530, Srikar Dronamraju wrote:

[..snip..]

> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -1185,10 +1185,34 @@ static inline void add_cpu_to_smallcore_masks(int cpu)
>  	}
>  }
> 
> +int get_physical_package_id(int cpu)
> +{
> +	int ppid = cpu_to_chip_id(cpu);
> +
> +#ifdef CONFIG_PPC_SPLPAR
> +	/*
> +	 * If the platform is PowerNV or Guest on KVM, ibm,chip-id is
> +	 * defined. Hence we would return the chip-id as the
> +	 * get_physical_package_id.
> +	 */
> +	if (ppid == -1 && firmware_has_feature(FW_FEATURE_LPAR)) {
> +		struct device_node *np = of_get_cpu_node(cpu, NULL);
> +
> +		if (np) {
> +			ppid = of_node_to_nid(np);
> +			of_node_put(np);
> +		}
> +	}
> +#endif /* CONFIG_PPC_SPLPAR */
> +
> +	return ppid;
> +}
> +EXPORT_SYMBOL_GPL(get_physical_package_id);
> +
>  static void add_cpu_to_masks(int cpu)
>  {
>  	int first_thread = cpu_first_thread_sibling(cpu);
> -	int chipid = cpu_to_chip_id(cpu);
> +	int ppid = get_physical_package_id(cpu);
>  	int i;
> 
>  	/*
> @@ -1217,11 +1241,11 @@ static void add_cpu_to_masks(int cpu)
>  	for_each_cpu(i, cpu_l2_cache_mask(cpu))
>  		set_cpus_related(cpu, i, cpu_core_mask);
> 
> -	if (chipid == -1)
> +	if (ppid == -1)
>  		return;

Can get_physical_package_id() return -1 ?

> 
>  	for_each_cpu(i, cpu_online_mask)
> -		if (cpu_to_chip_id(i) == chipid)
> +		if (get_physical_package_id(i) == ppid)
>  			set_cpus_related(cpu, i, cpu_core_mask);
>  }
> 
> -- 
> 2.18.1
>

--
Thanks and Regards
gautham.

  reply	other threads:[~2020-01-30 10:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 13:51 [PATCH v4] powerpc/smp: Use nid as fallback for package_id Srikar Dronamraju
2020-01-30 10:57 ` Gautham R Shenoy [this message]
2020-01-30 13:18   ` Srikar Dronamraju
2020-03-06  0:27 ` Michael Ellerman

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=20200130105747.GD1988@in.ibm.com \
    --to=ego@linux.vnet.ibm.com \
    --cc=hegdevasant@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=svaidy@linux.vnet.ibm.com \
    /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.