* [PATCH] powerpc: Use ibm,chip-id property to compute cpu_core_mask if available
@ 2013-07-04 3:05 Paul Mackerras
2013-08-09 7:22 ` [PATCH] powerpc: Use ibm, chip-id " Vasant Hegde
0 siblings, 1 reply; 3+ messages in thread
From: Paul Mackerras @ 2013-07-04 3:05 UTC (permalink / raw)
To: linuxppc-dev
Some systems have an ibm,chip-id property in the cpu nodes in the
device tree. On these systems, we now use that to compute the
cpu_core_mask (i.e. the set of core siblings) rather than looking
at cache properties.
Signed-off-by: Paul Mackerras <paulus@samba.org>
---
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index b72d8c9..3b7a118 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -587,6 +587,32 @@ int cpu_first_thread_of_core(int core)
}
EXPORT_SYMBOL_GPL(cpu_first_thread_of_core);
+static void traverse_siblings_chip_id(int cpu, int add, int chipid)
+{
+ const struct cpumask *mask;
+ struct device_node *np;
+ int i, plen;
+ const int *prop;
+
+ mask = add ? cpu_online_mask : cpu_present_mask;
+ for_each_cpu(i, mask) {
+ np = of_get_cpu_node(i, NULL);
+ if (!np)
+ continue;
+ prop = of_get_property(np, "ibm,chip-id", &plen);
+ if (prop && plen == sizeof(int) && *prop == chipid) {
+ if (add) {
+ cpumask_set_cpu(cpu, cpu_core_mask(i));
+ cpumask_set_cpu(i, cpu_core_mask(cpu));
+ } else {
+ cpumask_clear_cpu(cpu, cpu_core_mask(i));
+ cpumask_clear_cpu(i, cpu_core_mask(cpu));
+ }
+ }
+ of_node_put(np);
+ }
+}
+
/* Must be called when no change can occur to cpu_present_mask,
* i.e. during cpu online or offline.
*/
@@ -611,14 +637,29 @@ static struct device_node *cpu_to_l2cache(int cpu)
static void traverse_core_siblings(int cpu, int add)
{
- struct device_node *l2_cache;
+ struct device_node *l2_cache, *np;
const struct cpumask *mask;
- int i;
+ int i, chip, plen;
+ const int *prop;
+
+ /* 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 = *(int *)prop;
+ of_node_put(np);
+ if (chip >= 0) {
+ traverse_siblings_chip_id(cpu, add, chip);
+ return;
+ }
+ }
l2_cache = cpu_to_l2cache(cpu);
mask = add ? cpu_online_mask : cpu_present_mask;
for_each_cpu(i, mask) {
- struct device_node *np = cpu_to_l2cache(i);
+ np = cpu_to_l2cache(i);
if (!np)
continue;
if (np == l2_cache) {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Use ibm, chip-id property to compute cpu_core_mask if available
2013-07-04 3:05 [PATCH] powerpc: Use ibm,chip-id property to compute cpu_core_mask if available Paul Mackerras
@ 2013-08-09 7:22 ` Vasant Hegde
2013-08-10 3:44 ` [PATCH] powerpc: Use ibm,chip-id " Paul Mackerras
0 siblings, 1 reply; 3+ messages in thread
From: Vasant Hegde @ 2013-08-09 7:22 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
On 07/04/2013 08:35 AM, Paul Mackerras wrote:
> Some systems have an ibm,chip-id property in the cpu nodes in the
> device tree. On these systems, we now use that to compute the
> cpu_core_mask (i.e. the set of core siblings) rather than looking
> at cache properties.
>
Paul,
I wanted to test this patch but not able to apply this patch on top of Linux
tree. Looks like I'm missing traverse_core_siblings() related patch. I searched
in ppc mailing list and couldn't figure out.
Can you point me to related patch?
-Vasant
> Signed-off-by: Paul Mackerras <paulus@samba.org>
> ---
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index b72d8c9..3b7a118 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -587,6 +587,32 @@ int cpu_first_thread_of_core(int core)
> }
> EXPORT_SYMBOL_GPL(cpu_first_thread_of_core);
>
> +static void traverse_siblings_chip_id(int cpu, int add, int chipid)
> +{
> + const struct cpumask *mask;
> + struct device_node *np;
> + int i, plen;
> + const int *prop;
> +
> + mask = add ? cpu_online_mask : cpu_present_mask;
> + for_each_cpu(i, mask) {
> + np = of_get_cpu_node(i, NULL);
> + if (!np)
> + continue;
> + prop = of_get_property(np, "ibm,chip-id", &plen);
> + if (prop && plen == sizeof(int) && *prop == chipid) {
> + if (add) {
> + cpumask_set_cpu(cpu, cpu_core_mask(i));
> + cpumask_set_cpu(i, cpu_core_mask(cpu));
> + } else {
> + cpumask_clear_cpu(cpu, cpu_core_mask(i));
> + cpumask_clear_cpu(i, cpu_core_mask(cpu));
> + }
> + }
> + of_node_put(np);
> + }
> +}
> +
> /* Must be called when no change can occur to cpu_present_mask,
> * i.e. during cpu online or offline.
> */
> @@ -611,14 +637,29 @@ static struct device_node *cpu_to_l2cache(int cpu)
>
> static void traverse_core_siblings(int cpu, int add)
> {
> - struct device_node *l2_cache;
> + struct device_node *l2_cache, *np;
> const struct cpumask *mask;
> - int i;
> + int i, chip, plen;
> + const int *prop;
> +
> + /* 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 = *(int *)prop;
> + of_node_put(np);
> + if (chip >= 0) {
> + traverse_siblings_chip_id(cpu, add, chip);
> + return;
> + }
> + }
>
> l2_cache = cpu_to_l2cache(cpu);
> mask = add ? cpu_online_mask : cpu_present_mask;
> for_each_cpu(i, mask) {
> - struct device_node *np = cpu_to_l2cache(i);
> + np = cpu_to_l2cache(i);
> if (!np)
> continue;
> if (np == l2_cache) {
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Use ibm,chip-id property to compute cpu_core_mask if available
2013-08-09 7:22 ` [PATCH] powerpc: Use ibm, chip-id " Vasant Hegde
@ 2013-08-10 3:44 ` Paul Mackerras
0 siblings, 0 replies; 3+ messages in thread
From: Paul Mackerras @ 2013-08-10 3:44 UTC (permalink / raw)
To: Vasant Hegde; +Cc: linuxppc-dev
On Fri, Aug 09, 2013 at 12:52:12PM +0530, Vasant Hegde wrote:
> Paul,
>
> I wanted to test this patch but not able to apply this patch on top
> of Linux tree. Looks like I'm missing traverse_core_siblings()
> related patch. I searched in ppc mailing list and couldn't figure
> out.
Oops, my fault, there were actually 2 patches in that series but
somehow I only posted the second one. I'll repost both patches.
Paul.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-10 3:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-04 3:05 [PATCH] powerpc: Use ibm,chip-id property to compute cpu_core_mask if available Paul Mackerras
2013-08-09 7:22 ` [PATCH] powerpc: Use ibm, chip-id " Vasant Hegde
2013-08-10 3:44 ` [PATCH] powerpc: Use ibm,chip-id " Paul Mackerras
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).