linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] core: fix build error when referencing arch specific structures
@ 2007-09-07  4:09 travis
  2007-09-07  4:09 ` [PATCH 1/3] core: Provide an arch independent means of accessing cpu_sibling_map travis
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: travis @ 2007-09-07  4:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, Christoph Lameter, linux-mm, linux-kernel

Since the core kernel routines need to reference cpu_sibling_map,
whether it be a static array or a per_cpu data variable, an access
function has been defined.

In addition, changes have been made to the ia64 and ppc64 arch's to
move the cpu_sibling_map from a static cpumask_t array [NR_CPUS] to
be per_cpu cpumask_t arrays.

Note that I do not have the ability to build or test patch 3/3, the
ppc64 changes.

Patches are referenced against 2.6.23-rc4-mm1 .

-- 

--
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] 11+ messages in thread

* [PATCH 1/3] core: Provide an arch independent means of accessing cpu_sibling_map
  2007-09-07  4:09 [PATCH 0/3] core: fix build error when referencing arch specific structures travis
@ 2007-09-07  4:09 ` travis
  2007-09-07  4:09 ` [PATCH 2/3] ia64: Convert cpu_sibling_map to a per_cpu data array travis
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: travis @ 2007-09-07  4:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, Christoph Lameter, linux-mm, linux-kernel

[-- Attachment #1: fix-sched-build-error-with-cpu_sibling_map --]
[-- Type: text/plain, Size: 3432 bytes --]

As the block/blktrace.c and kernel/sched.c are common (core) files for
all architectures, an access function has been defined for referencing
the cpu_sibling_map array.

Signed-off-by: Mike Travis <travis@sgi.com>
---
 arch/ia64/Kconfig        |    1 -
 block/blktrace.c         |    2 +-
 include/asm-i386/smp.h   |    1 +
 include/asm-x86_64/smp.h |    1 +
 include/linux/smp.h      |    6 ++++++
 kernel/sched.c           |    8 ++++----
 6 files changed, 13 insertions(+), 6 deletions(-)

--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -308,7 +308,6 @@
 config SCHED_SMT
 	bool "SMT scheduler support"
 	depends on SMP
-	depends on BROKEN
 	help
 	  Improves the CPU scheduler's decision making when dealing with
 	  Intel IA64 chips with MultiThreading at a cost of slightly increased
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -536,7 +536,7 @@
 	for_each_online_cpu(cpu) {
 		unsigned long long *cpu_off, *sibling_off;
 
-		for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu)) {
+		for_each_cpu_mask(i, cpu_sibling_map(cpu)) {
 			if (i == cpu)
 				continue;
 
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5905,7 +5905,7 @@
 			     struct sched_group **sg)
 {
 	int group;
-	cpumask_t mask = per_cpu(cpu_sibling_map, cpu);
+	cpumask_t mask = cpu_sibling_map(cpu);
 	cpus_and(mask, mask, *cpu_map);
 	group = first_cpu(mask);
 	if (sg)
@@ -5934,7 +5934,7 @@
 	cpus_and(mask, mask, *cpu_map);
 	group = first_cpu(mask);
 #elif defined(CONFIG_SCHED_SMT)
-	cpumask_t mask = per_cpu(cpu_sibling_map, cpu);
+	cpumask_t mask = cpu_sibling_map(cpu);
 	cpus_and(mask, mask, *cpu_map);
 	group = first_cpu(mask);
 #else
@@ -6169,7 +6169,7 @@
 		p = sd;
 		sd = &per_cpu(cpu_domains, i);
 		*sd = SD_SIBLING_INIT;
-		sd->span = per_cpu(cpu_sibling_map, i);
+		sd->span = cpu_sibling_map(i);
 		cpus_and(sd->span, sd->span, *cpu_map);
 		sd->parent = p;
 		p->child = sd;
@@ -6180,7 +6180,7 @@
 #ifdef CONFIG_SCHED_SMT
 	/* Set up CPU (sibling) groups */
 	for_each_cpu_mask(i, *cpu_map) {
-		cpumask_t this_sibling_map = per_cpu(cpu_sibling_map, i);
+		cpumask_t this_sibling_map = cpu_sibling_map(i);
 		cpus_and(this_sibling_map, this_sibling_map, *cpu_map);
 		if (i != first_cpu(this_sibling_map))
 			continue;
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -32,6 +32,7 @@
 extern int smp_num_siblings;
 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
 DECLARE_PER_CPU(cpumask_t, cpu_core_map);
+#define cpu_sibling_map(cpu) per_cpu(cpu_sibling_map, cpu)
 
 extern void (*mtrr_hook) (void);
 extern void zap_low_mappings (void);
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -47,6 +47,7 @@
 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
 DECLARE_PER_CPU(cpumask_t, cpu_core_map);
 DECLARE_PER_CPU(u8, cpu_llc_id);
+#define cpu_sibling_map(cpu) per_cpu(cpu_sibling_map, cpu)
 
 #define SMP_TRAMPOLINE_BASE 0x6000
 
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -18,6 +18,12 @@
 #include <linux/thread_info.h>
 #include <asm/smp.h>
 
+#ifdef CONFIG_SCHED_SMT
+#ifndef cpu_sibling_map
+#define cpu_sibling_map(cpu) cpu_sibling_map[cpu]
+#endif
+#endif
+
 /*
  * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
  * (defined in asm header):

-- 

--
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] 11+ messages in thread

* [PATCH 2/3] ia64: Convert cpu_sibling_map to a per_cpu data array
  2007-09-07  4:09 [PATCH 0/3] core: fix build error when referencing arch specific structures travis
  2007-09-07  4:09 ` [PATCH 1/3] core: Provide an arch independent means of accessing cpu_sibling_map travis
@ 2007-09-07  4:09 ` travis
  2007-09-07  4:09 ` [PATCH 3/3] ppc64: " travis
  2007-09-07  7:28 ` [PATCH 0/3] core: fix build error when referencing arch specific structures Andi Kleen
  3 siblings, 0 replies; 11+ messages in thread
From: travis @ 2007-09-07  4:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, Christoph Lameter, linux-mm, linux-kernel

[-- Attachment #1: ia64-convert-cpu_sibling_map-to-per_cpu_data --]
[-- Type: text/plain, Size: 4175 bytes --]

Convert cpu_sibling_map to a per_cpu cpumask_t array for the ia64
architecture.

There was one access to cpu_sibling_map before the per_cpu data
area was created, so that step was moved to after the per_cpu
area is setup.

Note also that references to cpu_sibling_map have been changed
to use the cpu_sibling_map() function defined in patch 1/3.

Tested and verified on an A4700.

Signed-off-by: Mike Travis <travis@sgi.com>
---
 arch/ia64/kernel/setup.c    |    4 ----
 arch/ia64/kernel/smpboot.c  |   18 ++++++++++--------
 arch/ia64/mm/contig.c       |    6 ++++++
 include/asm-ia64/smp.h      |    3 ++-
 include/asm-ia64/topology.h |    2 +-
 5 files changed, 19 insertions(+), 14 deletions(-)

--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -528,10 +528,6 @@
 
 #ifdef CONFIG_SMP
 	cpu_physical_id(0) = hard_smp_processor_id();
-
-	cpu_set(0, cpu_sibling_map[0]);
-	cpu_set(0, cpu_core_map[0]);
-
 	check_for_logical_procs();
 	if (smp_num_cpucores > 1)
 		printk(KERN_INFO
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -138,7 +138,9 @@
 EXPORT_SYMBOL(cpu_possible_map);
 
 cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned;
-cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned;
+DEFINE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
+EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
+
 int smp_num_siblings = 1;
 int smp_num_cpucores = 1;
 
@@ -650,12 +652,12 @@
 {
 	int i;
 
-	for_each_cpu_mask(i, cpu_sibling_map[cpu])
-		cpu_clear(cpu, cpu_sibling_map[i]);
+	for_each_cpu_mask(i, cpu_sibling_map(cpu))
+		cpu_clear(cpu, cpu_sibling_map(i));
 	for_each_cpu_mask(i, cpu_core_map[cpu])
 		cpu_clear(cpu, cpu_core_map[i]);
 
-	cpu_sibling_map[cpu] = cpu_core_map[cpu] = CPU_MASK_NONE;
+	cpu_sibling_map(cpu) = cpu_core_map[cpu] = CPU_MASK_NONE;
 }
 
 static void
@@ -666,7 +668,7 @@
 	if (cpu_data(cpu)->threads_per_core == 1 &&
 	    cpu_data(cpu)->cores_per_socket == 1) {
 		cpu_clear(cpu, cpu_core_map[cpu]);
-		cpu_clear(cpu, cpu_sibling_map[cpu]);
+		cpu_clear(cpu, cpu_sibling_map(cpu));
 		return;
 	}
 
@@ -807,8 +809,8 @@
 			cpu_set(i, cpu_core_map[cpu]);
 			cpu_set(cpu, cpu_core_map[i]);
 			if (cpu_data(cpu)->core_id == cpu_data(i)->core_id) {
-				cpu_set(i, cpu_sibling_map[cpu]);
-				cpu_set(cpu, cpu_sibling_map[i]);
+				cpu_set(i, cpu_sibling_map(cpu));
+				cpu_set(cpu, cpu_sibling_map(i));
 			}
 		}
 	}
@@ -839,7 +841,7 @@
 
 	if (cpu_data(cpu)->threads_per_core == 1 &&
 	    cpu_data(cpu)->cores_per_socket == 1) {
-		cpu_set(cpu, cpu_sibling_map[cpu]);
+		cpu_set(cpu, cpu_sibling_map(cpu));
 		cpu_set(cpu, cpu_core_map[cpu]);
 		return 0;
 	}
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -58,7 +58,8 @@
 
 extern cpumask_t cpu_online_map;
 extern cpumask_t cpu_core_map[NR_CPUS];
-extern cpumask_t cpu_sibling_map[NR_CPUS];
+DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
+#define cpu_sibling_map(cpu) per_cpu(cpu_sibling_map, cpu)
 extern int smp_num_siblings;
 extern int smp_num_cpucores;
 extern void __iomem *ipi_base_addr;
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -112,7 +112,7 @@
 #define topology_physical_package_id(cpu)	(cpu_data(cpu)->socket_id)
 #define topology_core_id(cpu)			(cpu_data(cpu)->core_id)
 #define topology_core_siblings(cpu)		(cpu_core_map[cpu])
-#define topology_thread_siblings(cpu)		(cpu_sibling_map[cpu])
+#define topology_thread_siblings(cpu)		(cpu_sibling_map(cpu))
 #define smt_capable() 				(smp_num_siblings > 1)
 #endif
 
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -212,6 +212,12 @@
 			cpu_data += PERCPU_PAGE_SIZE;
 			per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
 		}
+		/*
+		 * cpu_sibling_map is now a per_cpu variable - it needs to
+		 * be accessed after per_cpu_init() sets up the per_cpu area.
+		 */
+		cpu_set(0, cpu_sibling_map(0));
+		cpu_set(0, cpu_core_map[0]);
 	}
 	return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
 }

-- 

--
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] 11+ messages in thread

* [PATCH 3/3] ppc64: Convert cpu_sibling_map to a per_cpu data array
  2007-09-07  4:09 [PATCH 0/3] core: fix build error when referencing arch specific structures travis
  2007-09-07  4:09 ` [PATCH 1/3] core: Provide an arch independent means of accessing cpu_sibling_map travis
  2007-09-07  4:09 ` [PATCH 2/3] ia64: Convert cpu_sibling_map to a per_cpu data array travis
@ 2007-09-07  4:09 ` travis
  2007-09-07 11:18   ` Kamalesh Babulal
  2007-09-07  7:28 ` [PATCH 0/3] core: fix build error when referencing arch specific structures Andi Kleen
  3 siblings, 1 reply; 11+ messages in thread
From: travis @ 2007-09-07  4:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, Christoph Lameter, linux-mm, linux-kernel

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

Convert cpu_sibling_map to a per_cpu cpumask_t array for the ppc64
architecture.

Note: these changes have not been built nor tested.

Note: I also don't know if these changes are particularly
relevant for the ppc64 architecture.

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

--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -415,9 +415,9 @@
 	 * 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, cpu_sibling_map(cpu));
 		if (cpu_has_feature(CPU_FTR_SMT))
-			cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
+			cpu_set(cpu ^ 0x1, cpu_sibling_map(cpu));
 	}
 
 	vdso_data->processorCount = num_present_cpus();
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -61,11 +61,11 @@
 
 cpumask_t cpu_possible_map = CPU_MASK_NONE;
 cpumask_t cpu_online_map = CPU_MASK_NONE;
-cpumask_t cpu_sibling_map[NR_CPUS] = { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
+DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
 
 EXPORT_SYMBOL(cpu_online_map);
 EXPORT_SYMBOL(cpu_possible_map);
-EXPORT_SYMBOL(cpu_sibling_map);
+EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
 
 /* SMP operations for this machine */
 struct smp_ops_t *smp_ops;
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -117,7 +117,7 @@
 	policy->cur = cbe_freqs[cur_pmode].frequency;
 
 #ifdef CONFIG_SMP
-	policy->cpus = cpu_sibling_map[policy->cpu];
+	policy->cpus = cpu_sibling_map(policy->cpu);
 #endif
 
 	cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
--- a/include/asm-powerpc/smp.h
+++ b/include/asm-powerpc/smp.h
@@ -58,7 +58,8 @@
 					(smp_hw_index[(cpu)] = (phys))
 #endif
 
-extern cpumask_t cpu_sibling_map[NR_CPUS];
+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.
  *
--- 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)	(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] 11+ messages in thread

* Re: [PATCH 0/3] core: fix build error when referencing arch specific structures
  2007-09-07  4:09 [PATCH 0/3] core: fix build error when referencing arch specific structures travis
                   ` (2 preceding siblings ...)
  2007-09-07  4:09 ` [PATCH 3/3] ppc64: " travis
@ 2007-09-07  7:28 ` Andi Kleen
  2007-09-07 10:56   ` Andrew Morton
  2007-09-07 15:43   ` Mike Travis
  3 siblings, 2 replies; 11+ messages in thread
From: Andi Kleen @ 2007-09-07  7:28 UTC (permalink / raw)
  To: travis; +Cc: Andrew Morton, Christoph Lameter, linux-mm, linux-kernel

On Friday 07 September 2007 05:09, travis@sgi.com wrote:
> Since the core kernel routines need to reference cpu_sibling_map,
> whether it be a static array or a per_cpu data variable, an access
> function has been defined.
>
> In addition, changes have been made to the ia64 and ppc64 arch's to
> move the cpu_sibling_map from a static cpumask_t array [NR_CPUS] to
> be per_cpu cpumask_t arrays.
>
> Note that I do not have the ability to build or test patch 3/3, the
> ppc64 changes.
>
> Patches are referenced against 2.6.23-rc4-mm1 .

It would be better if you could redo the patches with the original patches
reverted, not incremental changes. In the end we'll need a full patch set
with full changelog anyways, not a series of incremental fixes.

Also I guess some powerpc testers would be needed. Perhaps cc the
maintainers?

-Andi

--
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] 11+ messages in thread

* Re: [PATCH 0/3] core: fix build error when referencing arch specific structures
  2007-09-07  7:28 ` [PATCH 0/3] core: fix build error when referencing arch specific structures Andi Kleen
@ 2007-09-07 10:56   ` Andrew Morton
  2007-09-07 15:47     ` Mike Travis
  2007-09-07 15:43   ` Mike Travis
  1 sibling, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2007-09-07 10:56 UTC (permalink / raw)
  To: Andi Kleen; +Cc: travis, clameter, linux-mm, linux-kernel

> On Fri, 7 Sep 2007 08:28:05 +0100 Andi Kleen <ak@suse.de> wrote:
> On Friday 07 September 2007 05:09, travis@sgi.com wrote:
> > Since the core kernel routines need to reference cpu_sibling_map,
> > whether it be a static array or a per_cpu data variable, an access
> > function has been defined.
> >
> > In addition, changes have been made to the ia64 and ppc64 arch's to
> > move the cpu_sibling_map from a static cpumask_t array [NR_CPUS] to
> > be per_cpu cpumask_t arrays.
> >
> > Note that I do not have the ability to build or test patch 3/3, the
> > ppc64 changes.
> >
> > Patches are referenced against 2.6.23-rc4-mm1 .
> 
> It would be better if you could redo the patches with the original patches
> reverted, not incremental changes. In the end we'll need a full patch set
> with full changelog anyways, not a series of incremental fixes.

yup
 
> Also I guess some powerpc testers would be needed. Perhaps cc the
> maintainers?
> 

yup

All architectures except sparc64 are now done - please have a shot at doing
sparc64 as well.

I'd suggest that we not implement that cpu_sibling_map() macro and just
open-code the per_cpu() everywhere.  So henceforth any architecture which
implements CONFIG_SCHED_SMT must implement the per-cpu sibling map.

That's nice and simple, and avoids the unpleasant
pretend-function-used-as-an-lvalue trick.  (Well OK, per_cpu() does
that, but let's avoid resinning).

--
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] 11+ messages in thread

* Re: [PATCH 3/3] ppc64: Convert cpu_sibling_map to a per_cpu data array
  2007-09-07  4:09 ` [PATCH 3/3] ppc64: " travis
@ 2007-09-07 11:18   ` Kamalesh Babulal
  2007-09-07 12:59     ` Kamalesh Babulal
  0 siblings, 1 reply; 11+ messages in thread
From: Kamalesh Babulal @ 2007-09-07 11:18 UTC (permalink / raw)
  To: travis
  Cc: Andrew Morton, Andi Kleen, Christoph Lameter, linux-mm, linux-kernel

travis@sgi.com wrote:
> Convert cpu_sibling_map to a per_cpu cpumask_t array for the ppc64
> architecture.
>
> Note: these changes have not been built nor tested.
>
> Note: I also don't know if these changes are particularly
> relevant for the ppc64 architecture.
>
> Signed-off-by: Mike Travis <travis@sgi.com>
> ---
>  arch/powerpc/kernel/setup-common.c        |    4 ++--
>  arch/powerpc/kernel/smp.c                 |    4 ++--
>  arch/powerpc/platforms/cell/cbe_cpufreq.c |    2 +-
>  include/asm-powerpc/smp.h                 |    3 ++-
>  include/asm-powerpc/topology.h            |    2 +-
>  5 files changed, 8 insertions(+), 7 deletions(-)
>
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -415,9 +415,9 @@
>  	 * 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, cpu_sibling_map(cpu));
>  		if (cpu_has_feature(CPU_FTR_SMT))
> -			cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
> +			cpu_set(cpu ^ 0x1, cpu_sibling_map(cpu));
>  	}
>
>  	vdso_data->processorCount = num_present_cpus();
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -61,11 +61,11 @@
>
>  cpumask_t cpu_possible_map = CPU_MASK_NONE;
>  cpumask_t cpu_online_map = CPU_MASK_NONE;
> -cpumask_t cpu_sibling_map[NR_CPUS] = { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
> +DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
>
>  EXPORT_SYMBOL(cpu_online_map);
>  EXPORT_SYMBOL(cpu_possible_map);
> -EXPORT_SYMBOL(cpu_sibling_map);
> +EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
>
>  /* SMP operations for this machine */
>  struct smp_ops_t *smp_ops;
> --- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
> +++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
> @@ -117,7 +117,7 @@
>  	policy->cur = cbe_freqs[cur_pmode].frequency;
>
>  #ifdef CONFIG_SMP
> -	policy->cpus = cpu_sibling_map[policy->cpu];
> +	policy->cpus = cpu_sibling_map(policy->cpu);
>  #endif
>
>  	cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
> --- a/include/asm-powerpc/smp.h
> +++ b/include/asm-powerpc/smp.h
> @@ -58,7 +58,8 @@
>  					(smp_hw_index[(cpu)] = (phys))
>  #endif
>
> -extern cpumask_t cpu_sibling_map[NR_CPUS];
> +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.
>   *
> --- 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)	(cpu_sibling_map(cpu))
>  #endif
>  #endif
>
>
>   
Hi Mike,

After applying the patch, the build fails with following error

CHK include/linux/version.h
CHK include/linux/utsrelease.h
CC arch/powerpc/kernel/asm-offsets.s
In file included from include/linux/smp.h:19,
from include/linux/topology.h:33,
from include/linux/mmzone.h:660,
from include/linux/gfp.h:4,
from include/linux/slab.h:14,
from include/linux/percpu.h:5,
from include/asm/time.h:18,
from include/asm/cputime.h:26,
from include/linux/sched.h:65,
from arch/powerpc/kernel/asm-offsets.c:17:
include/asm/smp.h:61: error: expected declaration specifiers or ?...? 
before ?cpu_sibling_map?
include/asm/smp.h:61: warning: data definition has no type or storage class
include/asm/smp.h:61: warning: type defaults to ?int? in declaration of 
?DECLARE_PER_CPU?
make[1]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2

Thanks & Regards,
Kamalesh Babulal.

--
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] 11+ messages in thread

* Re: [PATCH 3/3] ppc64: Convert cpu_sibling_map to a per_cpu data array
  2007-09-07 11:18   ` Kamalesh Babulal
@ 2007-09-07 12:59     ` Kamalesh Babulal
  2007-09-07 15:36       ` Mike Travis
  0 siblings, 1 reply; 11+ messages in thread
From: Kamalesh Babulal @ 2007-09-07 12:59 UTC (permalink / raw)
  To: travis
  Cc: Andrew Morton, Andi Kleen, Christoph Lameter, linux-mm, linux-kernel

Kamalesh Babulal wrote:
> travis@sgi.com wrote:
>> Convert cpu_sibling_map to a per_cpu cpumask_t array for the ppc64
>> architecture.
>>
>> Note: these changes have not been built nor tested.
>>
>> Note: I also don't know if these changes are particularly
>> relevant for the ppc64 architecture.
>>
>> Signed-off-by: Mike Travis <travis@sgi.com>
>> ---
>>  arch/powerpc/kernel/setup-common.c        |    4 ++--
>>  arch/powerpc/kernel/smp.c                 |    4 ++--
>>  arch/powerpc/platforms/cell/cbe_cpufreq.c |    2 +-
>>  include/asm-powerpc/smp.h                 |    3 ++-
>>  include/asm-powerpc/topology.h            |    2 +-
>>  5 files changed, 8 insertions(+), 7 deletions(-)
>>
>> --- a/arch/powerpc/kernel/setup-common.c
>> +++ b/arch/powerpc/kernel/setup-common.c
>> @@ -415,9 +415,9 @@
>>       * 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, cpu_sibling_map(cpu));
>>          if (cpu_has_feature(CPU_FTR_SMT))
>> -            cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
>> +            cpu_set(cpu ^ 0x1, cpu_sibling_map(cpu));
>>      }
>>
>>      vdso_data->processorCount = num_present_cpus();
>> --- a/arch/powerpc/kernel/smp.c
>> +++ b/arch/powerpc/kernel/smp.c
>> @@ -61,11 +61,11 @@
>>
>>  cpumask_t cpu_possible_map = CPU_MASK_NONE;
>>  cpumask_t cpu_online_map = CPU_MASK_NONE;
>> -cpumask_t cpu_sibling_map[NR_CPUS] = { [0 ... NR_CPUS-1] = 
>> CPU_MASK_NONE };
>> +DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
>>
>>  EXPORT_SYMBOL(cpu_online_map);
>>  EXPORT_SYMBOL(cpu_possible_map);
>> -EXPORT_SYMBOL(cpu_sibling_map);
>> +EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
>>
>>  /* SMP operations for this machine */
>>  struct smp_ops_t *smp_ops;
>> --- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
>> +++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
>> @@ -117,7 +117,7 @@
>>      policy->cur = cbe_freqs[cur_pmode].frequency;
>>
>>  #ifdef CONFIG_SMP
>> -    policy->cpus = cpu_sibling_map[policy->cpu];
>> +    policy->cpus = cpu_sibling_map(policy->cpu);
>>  #endif
>>
>>      cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
>> --- a/include/asm-powerpc/smp.h
>> +++ b/include/asm-powerpc/smp.h
>> @@ -58,7 +58,8 @@
>>                      (smp_hw_index[(cpu)] = (phys))
>>  #endif
>>
>> -extern cpumask_t cpu_sibling_map[NR_CPUS];
>> +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.
>>   *
>> --- 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)    (cpu_sibling_map(cpu))
>>  #endif
>>  #endif
>>
>>
>>   
> Hi Mike,
>
> After applying the patch, the build fails with following error
>
> CHK include/linux/version.h
> CHK include/linux/utsrelease.h
> CC arch/powerpc/kernel/asm-offsets.s
> In file included from include/linux/smp.h:19,
> from include/linux/topology.h:33,
> from include/linux/mmzone.h:660,
> from include/linux/gfp.h:4,
> from include/linux/slab.h:14,
> from include/linux/percpu.h:5,
> from include/asm/time.h:18,
> from include/asm/cputime.h:26,
> from include/linux/sched.h:65,
> from arch/powerpc/kernel/asm-offsets.c:17:
> include/asm/smp.h:61: error: expected declaration specifiers or ?...? 
> before ?cpu_sibling_map?
> include/asm/smp.h:61: warning: data definition has no type or storage 
> class
> include/asm/smp.h:61: warning: type defaults to ?int? in declaration 
> of ?DECLARE_PER_CPU?
> make[1]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1
> make: *** [prepare0] Error 2
>
> Thanks & Regards,
> Kamalesh Babulal.
Hi Make,

I tried to debug and probably the patch below could help the build error

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
----

--- a/include/asm-powerpc/smp.h 2007-09-07 18:15:43.000000000 +0530
+++ b/include/asm-powerpc/smp.h 2007-09-07 18:16:02.000000000 +0530
@@ -25,6 +25,7 @@
 
 #ifdef CONFIG_PPC64
 #include <asm/paca.h>
+#include <asm/percpu.h>
 #endif
 
 extern int boot_cpuid;

---
Thanks & Regards,
Kamalesh Babulal.




--
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] 11+ messages in thread

* Re: [PATCH 3/3] ppc64: Convert cpu_sibling_map to a per_cpu data array
  2007-09-07 12:59     ` Kamalesh Babulal
@ 2007-09-07 15:36       ` Mike Travis
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Travis @ 2007-09-07 15:36 UTC (permalink / raw)
  To: Kamalesh Babulal
  Cc: Andrew Morton, Andi Kleen, Christoph Lameter, linux-mm, linux-kernel

Kamalesh Babulal wrote:
> Kamalesh Babulal wrote:
>> travis@sgi.com wrote:
>>> Convert cpu_sibling_map to a per_cpu cpumask_t array for the ppc64
>>> architecture.
>>>
>>> Note: these changes have not been built nor tested.
>>>
>>> Note: I also don't know if these changes are particularly
>>> relevant for the ppc64 architecture.
>>>
>>> Signed-off-by: Mike Travis <travis@sgi.com>
>>> ---
>>>  arch/powerpc/kernel/setup-common.c        |    4 ++--
>>>  arch/powerpc/kernel/smp.c                 |    4 ++--
>>>  arch/powerpc/platforms/cell/cbe_cpufreq.c |    2 +-
>>>  include/asm-powerpc/smp.h                 |    3 ++-
>>>  include/asm-powerpc/topology.h            |    2 +-
>>>  5 files changed, 8 insertions(+), 7 deletions(-)
>>>
>>> --- a/arch/powerpc/kernel/setup-common.c
>>> +++ b/arch/powerpc/kernel/setup-common.c
>>> @@ -415,9 +415,9 @@
>>>       * 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, cpu_sibling_map(cpu));
>>>          if (cpu_has_feature(CPU_FTR_SMT))
>>> -            cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
>>> +            cpu_set(cpu ^ 0x1, cpu_sibling_map(cpu));
>>>      }
>>>
>>>      vdso_data->processorCount = num_present_cpus();
>>> --- a/arch/powerpc/kernel/smp.c
>>> +++ b/arch/powerpc/kernel/smp.c
>>> @@ -61,11 +61,11 @@
>>>
>>>  cpumask_t cpu_possible_map = CPU_MASK_NONE;
>>>  cpumask_t cpu_online_map = CPU_MASK_NONE;
>>> -cpumask_t cpu_sibling_map[NR_CPUS] = { [0 ... NR_CPUS-1] =
>>> CPU_MASK_NONE };
>>> +DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
>>>
>>>  EXPORT_SYMBOL(cpu_online_map);
>>>  EXPORT_SYMBOL(cpu_possible_map);
>>> -EXPORT_SYMBOL(cpu_sibling_map);
>>> +EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
>>>
>>>  /* SMP operations for this machine */
>>>  struct smp_ops_t *smp_ops;
>>> --- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
>>> +++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
>>> @@ -117,7 +117,7 @@
>>>      policy->cur = cbe_freqs[cur_pmode].frequency;
>>>
>>>  #ifdef CONFIG_SMP
>>> -    policy->cpus = cpu_sibling_map[policy->cpu];
>>> +    policy->cpus = cpu_sibling_map(policy->cpu);
>>>  #endif
>>>
>>>      cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
>>> --- a/include/asm-powerpc/smp.h
>>> +++ b/include/asm-powerpc/smp.h
>>> @@ -58,7 +58,8 @@
>>>                      (smp_hw_index[(cpu)] = (phys))
>>>  #endif
>>>
>>> -extern cpumask_t cpu_sibling_map[NR_CPUS];
>>> +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.
>>>   *
>>> --- 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)    (cpu_sibling_map(cpu))
>>>  #endif
>>>  #endif
>>>
>>>
>>>   
>> Hi Mike,
>>
>> After applying the patch, the build fails with following error
>>
>> CHK include/linux/version.h
>> CHK include/linux/utsrelease.h
>> CC arch/powerpc/kernel/asm-offsets.s
>> In file included from include/linux/smp.h:19,
>> from include/linux/topology.h:33,
>> from include/linux/mmzone.h:660,
>> from include/linux/gfp.h:4,
>> from include/linux/slab.h:14,
>> from include/linux/percpu.h:5,
>> from include/asm/time.h:18,
>> from include/asm/cputime.h:26,
>> from include/linux/sched.h:65,
>> from arch/powerpc/kernel/asm-offsets.c:17:
>> include/asm/smp.h:61: error: expected declaration specifiers or ?...?
>> before ?cpu_sibling_map?
>> include/asm/smp.h:61: warning: data definition has no type or storage
>> class
>> include/asm/smp.h:61: warning: type defaults to ?int? in declaration
>> of ?DECLARE_PER_CPU?
>> make[1]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1
>> make: *** [prepare0] Error 2
>>
>> Thanks & Regards,
>> Kamalesh Babulal.
> Hi Make,
> 
> I tried to debug and probably the patch below could help the build error
> 
> Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
> ----
> 
> --- a/include/asm-powerpc/smp.h 2007-09-07 18:15:43.000000000 +0530
> +++ b/include/asm-powerpc/smp.h 2007-09-07 18:16:02.000000000 +0530
> @@ -25,6 +25,7 @@
> 
> #ifdef CONFIG_PPC64
> #include <asm/paca.h>
> +#include <asm/percpu.h>
> #endif
> 
> extern int boot_cpuid;
> 
> ---
> Thanks & Regards,
> Kamalesh Babulal.
> 
> 
> 

Thanks!   I'll merge the above in...

Mike

--
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] 11+ messages in thread

* Re: [PATCH 0/3] core: fix build error when referencing arch specific structures
  2007-09-07  7:28 ` [PATCH 0/3] core: fix build error when referencing arch specific structures Andi Kleen
  2007-09-07 10:56   ` Andrew Morton
@ 2007-09-07 15:43   ` Mike Travis
  1 sibling, 0 replies; 11+ messages in thread
From: Mike Travis @ 2007-09-07 15:43 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, Christoph Lameter, linux-mm, linux-kernel

Andi Kleen wrote:
> On Friday 07 September 2007 05:09, travis@sgi.com wrote:
>> Since the core kernel routines need to reference cpu_sibling_map,
>> whether it be a static array or a per_cpu data variable, an access
>> function has been defined.
>>
>> In addition, changes have been made to the ia64 and ppc64 arch's to
>> move the cpu_sibling_map from a static cpumask_t array [NR_CPUS] to
>> be per_cpu cpumask_t arrays.
>>
>> Note that I do not have the ability to build or test patch 3/3, the
>> ppc64 changes.
>>
>> Patches are referenced against 2.6.23-rc4-mm1 .
> 
> It would be better if you could redo the patches with the original patches
> reverted, not incremental changes. In the end we'll need a full patch set
> with full changelog anyways, not a series of incremental fixes.

Will do.  Thanks.

I take it I should run a diff against rc4 (w/o mm1) to regenerate a
complete patch, including the prior ones?

> 
> Also I guess some powerpc testers would be needed. Perhaps cc the
> maintainers?

I've been looking for where to Cc: those guys (as Andrew probably realizes
from his extra "spam" from me. ;-)

Thanks!
Mike

--
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] 11+ messages in thread

* Re: [PATCH 0/3] core: fix build error when referencing arch specific structures
  2007-09-07 10:56   ` Andrew Morton
@ 2007-09-07 15:47     ` Mike Travis
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Travis @ 2007-09-07 15:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, clameter, linux-mm, linux-kernel

Andrew Morton wrote:
>> On Fri, 7 Sep 2007 08:28:05 +0100 Andi Kleen <ak@suse.de> wrote:
>> On Friday 07 September 2007 05:09, travis@sgi.com wrote:
>>> Since the core kernel routines need to reference cpu_sibling_map,
>>> whether it be a static array or a per_cpu data variable, an access
>>> function has been defined.
>>>
>>> In addition, changes have been made to the ia64 and ppc64 arch's to
>>> move the cpu_sibling_map from a static cpumask_t array [NR_CPUS] to
>>> be per_cpu cpumask_t arrays.
>>>
>>> Note that I do not have the ability to build or test patch 3/3, the
>>> ppc64 changes.
>>>
>>> Patches are referenced against 2.6.23-rc4-mm1 .
>> It would be better if you could redo the patches with the original patches
>> reverted, not incremental changes. In the end we'll need a full patch set
>> with full changelog anyways, not a series of incremental fixes.
> 
> yup
>  
>> Also I guess some powerpc testers would be needed. Perhaps cc the
>> maintainers?
>>
> 
> yup
> 
> All architectures except sparc64 are now done - please have a shot at doing
> sparc64 as well.

Ok, will do.  I didn't realize there was only one more that used the SCHED_SMT
code.

> 
> I'd suggest that we not implement that cpu_sibling_map() macro and just
> open-code the per_cpu() everywhere.  So henceforth any architecture which
> implements CONFIG_SCHED_SMT must implement the per-cpu sibling map.

Yes, with only one more to do it's not that daunting. ;-)

> That's nice and simple, and avoids the unpleasant
> pretend-function-used-as-an-lvalue trick.  (Well OK, per_cpu() does
> that, but let's avoid resinning).

Yes, the per_cpu macro is quite the specimen. ;-)

Thanks!
Mike

--
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] 11+ messages in thread

end of thread, other threads:[~2007-09-07 15:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-07  4:09 [PATCH 0/3] core: fix build error when referencing arch specific structures travis
2007-09-07  4:09 ` [PATCH 1/3] core: Provide an arch independent means of accessing cpu_sibling_map travis
2007-09-07  4:09 ` [PATCH 2/3] ia64: Convert cpu_sibling_map to a per_cpu data array travis
2007-09-07  4:09 ` [PATCH 3/3] ppc64: " travis
2007-09-07 11:18   ` Kamalesh Babulal
2007-09-07 12:59     ` Kamalesh Babulal
2007-09-07 15:36       ` Mike Travis
2007-09-07  7:28 ` [PATCH 0/3] core: fix build error when referencing arch specific structures Andi Kleen
2007-09-07 10:56   ` Andrew Morton
2007-09-07 15:47     ` Mike Travis
2007-09-07 15:43   ` Mike Travis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox