linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] ppc64: Convert cpu_sibling_map to a per_cpu data array ppc64 v2
@ 2007-09-17 18:35 travis
  2007-09-17 18:35 ` [PATCH 1/1] " travis
  0 siblings, 1 reply; 3+ messages in thread
From: travis @ 2007-09-17 18:35 UTC (permalink / raw)
  To: sfr, Andrew Morton
  Cc: Andi Kleen, Christoph Lameter, linux-mm, linux-kernel,
	linuxppc-dev, sparclinux

Stephen Rothwell wrote:
> On Mon, 17 Sep 2007 16:28:31 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>> 	the topology (on my POWERPC5+ box) is not correct:
>>
>> cpu0/topology/thread_siblings:0000000f
>> cpu1/topology/thread_siblings:0000000f
>> cpu2/topology/thread_siblings:0000000f
>> cpu3/topology/thread_siblings:0000000f
>>
>> it used to be:
>>
>> cpu0/topology/thread_siblings:00000003
>> cpu1/topology/thread_siblings:00000003
>> cpu2/topology/thread_siblings:0000000c
>> cpu3/topology/thread_siblings:0000000c
> 
> This would be because we are setting up the cpu_sibling map before we
> call setup_per_cpu_areas().

The following patch hopefully should fix this problem.  I'm
not able to build or test it but the few references to 
cpu_sibling_map seem to all occur well after setup_per_cpu_areas
is called.

Thanks Stephen for checking this out!

-- 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] ppc64: Convert cpu_sibling_map to a per_cpu data array ppc64 v2
  2007-09-17 18:35 [PATCH 0/1] ppc64: Convert cpu_sibling_map to a per_cpu data array ppc64 v2 travis
@ 2007-09-17 18:35 ` travis
  2007-09-19  6:56   ` Stephen Rothwell
  0 siblings, 1 reply; 3+ messages in thread
From: travis @ 2007-09-17 18:35 UTC (permalink / raw)
  To: sfr, Andrew Morton
  Cc: Andi Kleen, Christoph Lameter, linux-mm, linux-kernel,
	linuxppc-dev, sparclinux

[-- Attachment #1: convert-ppc64-cpu_sibling_map-to-per_cpu_data-2 --]
[-- Type: text/plain, Size: 3574 bytes --]

This patch applies after:

	convert-cpu_sibling_map-to-a-per_cpu-data-array-ppc64.patch

and should fix the "reference cpu_sibling_map before setup_per_cpu_areas()
has been called" problem.  In addtion, the cpu_sibiling_map macro has been
removed [this was missed in my original submission.]

Original Notes:

Convert cpu_sibling_map to a per_cpu cpumask_t array for the ppc64
architecture.  This fixes build errors in block/blktrace.c and
kernel/sched.c when CONFIG_SCHED_SMT is defined.

Note: these changes have not been built nor tested.

Signed-off-by: Mike Travis <travis@sgi.com>
---
 arch/powerpc/kernel/setup-common.c        |   20 ++++++++++++++++----
 arch/powerpc/kernel/setup_64.c            |    3 +++
 arch/powerpc/platforms/cell/cbe_cpufreq.c |    2 +-
 include/asm-powerpc/smp.h                 |    2 +-
 include/asm-powerpc/topology.h            |    2 +-
 5 files changed, 22 insertions(+), 7 deletions(-)

--- a/include/asm-powerpc/smp.h
+++ b/include/asm-powerpc/smp.h
@@ -60,7 +60,6 @@
 #endif
 
 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
-#define cpu_sibling_map(cpu) per_cpu(cpu_sibling_map, cpu)
 
 /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
  *
@@ -79,6 +78,7 @@
 void smp_init_cell(void);
 void smp_init_celleb(void);
 void smp_setup_cpu_maps(void);
+void smp_setup_cpu_sibling_map(void);
 
 extern int __cpu_disable(void);
 extern void __cpu_die(unsigned int cpu);
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -596,6 +596,9 @@
 		paca[i].data_offset = ptr - __per_cpu_start;
 		memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
 	}
+
+	/* Now that per_cpu is setup, initialize cpu_sibling_map */
+	smp_setup_cpu_sibling_map();
 }
 #endif
 
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -411,16 +411,28 @@
 		of_node_put(dn);
 	}
 
+	vdso_data->processorCount = num_present_cpus();
+#endif /* CONFIG_PPC64 */
+}
+
+/*
+ * Being that cpu_sibling_map is now a per_cpu array, then it cannot
+ * be initialized until the per_cpu areas have been created.  This
+ * function is now called from setup_per_cpu_areas().
+ */
+void __init smp_setup_cpu_sibling_map(void)
+{
+#if defined(CONFIG_PPC64)
+	int cpu;
+
 	/*
 	 * Do the sibling map; assume only two threads per processor.
 	 */
 	for_each_possible_cpu(cpu) {
-		cpu_set(cpu, cpu_sibling_map(cpu));
+		cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
 		if (cpu_has_feature(CPU_FTR_SMT))
-			cpu_set(cpu ^ 0x1, cpu_sibling_map(cpu));
+			cpu_set(cpu ^ 0x1, per_cpu(cpu_sibling_map, cpu));
 	}
-
-	vdso_data->processorCount = num_present_cpus();
 #endif /* CONFIG_PPC64 */
 }
 #endif /* CONFIG_SMP */
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -119,7 +119,7 @@
 	policy->cur = cbe_freqs[cur_pmode].frequency;
 
 #ifdef CONFIG_SMP
-	policy->cpus = cpu_sibling_map(policy->cpu);
+	policy->cpus = per_cpu(cpu_sibling_map, policy->cpu);
 #endif
 
 	cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -108,7 +108,7 @@
 #ifdef CONFIG_PPC64
 #include <asm/smp.h>
 
-#define topology_thread_siblings(cpu)	(cpu_sibling_map(cpu))
+#define topology_thread_siblings(cpu)	(per_cpu(cpu_sibling_map, cpu))
 #endif
 #endif
 

-- 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] ppc64: Convert cpu_sibling_map to a per_cpu data array ppc64 v2
  2007-09-17 18:35 ` [PATCH 1/1] " travis
@ 2007-09-19  6:56   ` Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2007-09-19  6:56 UTC (permalink / raw)
  To: travis
  Cc: Andrew Morton, Andi Kleen, Christoph Lameter, linux-mm,
	linux-kernel, linuxppc-dev, sparclinux

[-- Attachment #1: Type: text/plain, Size: 541 bytes --]

Hi Mike,

On Mon, 17 Sep 2007 11:35:08 -0700 travis@sgi.com wrote:
>
> v2: 
> 
> This patch applies after:
> 
> 	convert-cpu_sibling_map-to-a-per_cpu-data-array-ppc64.patch
> 
> and should fix the "reference cpu_sibling_map before setup_per_cpu_areas()
> has been called" problem.  In addtion, the cpu_sibiling_map macro has been
> removed [this was missed in my original submission.]

This one make it work, thanks.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-09-19  6:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-17 18:35 [PATCH 0/1] ppc64: Convert cpu_sibling_map to a per_cpu data array ppc64 v2 travis
2007-09-17 18:35 ` [PATCH 1/1] " travis
2007-09-19  6:56   ` Stephen Rothwell

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).