percpu: Per cpu code simplification fixup
Subsystems (6)
cover percpu: Per cpu code simplification fixup
This patchset simplifies the code that arches need to maintain to support per cpu functionality. Most of the code is moved into arch independent code. Only a minimal set of definitions is kept for each arch.
The patch also unifies the x86 arch so that there is only a single asm-x86/percpu.h
Based on: 2.6.24-rc8-mm1
---
fixup:
- rebased from 2.6.24-rc6-mm1 to 2.6.24-rc8-mm1 (removed changes that are in the git-x86.patch)
- added back in missing fold-percpu_modcopy pieces
V3->V4:
- rebased patchset on 2.6.24-rc6-mm1
(removes the percpu_modcopy changes that are already in.)
- change config ARCH_SETS_UP_PER_CPU_AREA to a global var and use select HAVE_SETUP_PER_CPU_AREA to specify.
V2->V3:
- fix x86_64 non-SMP case
- change SHIFT_PTR to SHIFT_PERCPU_PTR
- fix various percpu_modcopy()'s to reference correct per_cpu_offset()
- s390 has a special way to determine the pointer to a per cpu area
V1->V2:
- Add support for specifying attributes for per cpu declarations (preserves IA64 model(small) attribute).
- Drop first patch that removes the model(small) attribute for IA64
- Missing #endif in powerpc generic config / Wrong Kconfig
- Follow Randy's suggestions on how to do the Kconfig settings
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/7 Modules: Fold percpu_modcopy into module.c
percpu_modcopy() is defined multiple times in arch files. However, the only user is module.c. Put a static definition into module.c and remove the definitions from the arch files.
--- arch/ia64/kernel/module.c | 11 ----------- include/asm-generic/percpu.h | 8 -------- include/asm-ia64/percpu.h | 5 ----- include/asm-powerpc/percpu.h | 9 --------- include/asm-s390/percpu.h | 9 --------- kernel/module.c | 8 ++++++++ 6 files changed, 8 insertions(+), 42 deletions(-)
arch/ia64/kernel/module.c +0 -11
@@ -940,14 +940,3 @@ module_arch_cleanup (struct module *mod)if (mod->arch.core_unw_table)unw_remove_unwind_table (mod->arch.core_unw_table); } - -#ifdef CONFIG_SMP -void -percpu_modcopy (void *pcpudst,const void *src,unsigned long size) -{ -unsigned int i; -for_each_possible_cpu (i) { -memcpy (pcpudst +per_cpu_offset (i), src, size); - } -} -#endif /* CONFIG_SMP */
include/asm-generic/percpu.h +0 -8
@@ -63,14 +63,6 @@ extern unsigned long __per_cpu_offset[NRextern void setup_per_cpu_areas (void );#endif -/* A macro to avoid #include hell... */ -#define percpu_modcopy (pcpudst, src, size) \ -do { \ - unsigned int __i; \ - for_each_possible_cpu(__i) \ - memcpy((pcpudst)+per_cpu_offset(__i), \ - (src), (size)); \ -} while (0)#else /* ! SMP */ #define per_cpu (var, cpu) (*((void)(cpu), &per_cpu_var(var)))
include/asm-ia64/percpu.h +0 -5
@@ -22,10 +22,6 @@#define DECLARE_PER_CPU (type, name) \ extern PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name -/* -* Pretty much a literal copy of asm-generic/percpu.h, except that percpu_modcopy() is an -* external routine, to avoid include-hell. -*/ #ifdef CONFIG_SMP extern unsigned long __per_cpu_offset[NR_CPUS ];
@@ -38,7 +34,6 @@ DECLARE_PER_CPU(unsigned long, local_per#define __get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))#define __raw_get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset))) -extern void percpu_modcopy (void *pcpudst,const void *src,unsigned long size);extern void setup_per_cpu_areas (void );extern void *per_cpu_init (void );
include/asm-powerpc/percpu.h +0 -9
@@ -21,15 +21,6 @@#define __get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))#define __raw_get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, local_paca->data_offset)) -/* A macro to avoid #include hell... */ -#define percpu_modcopy (pcpudst, src, size) \ -do { \ - unsigned int __i; \ - for_each_possible_cpu(__i) \ - memcpy((pcpudst)+__per_cpu_offset(__i), \ - (src), (size)); \ -} while (0) -extern void setup_per_cpu_areas (void );#else /* ! SMP */
include/asm-s390/percpu.h +0 -9
@@ -39,15 +39,6 @@ extern unsigned long __per_cpu_offset[NR#define per_cpu (var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])#define per_cpu_offset (x) (__per_cpu_offset[x]) -/* A macro to avoid #include hell... */ -#define percpu_modcopy (pcpudst, src, size) \ -do { \ - unsigned int __i; \ - for_each_possible_cpu(__i) \ - memcpy((pcpudst)+__per_cpu_offset[__i], \ - (src), (size)); \ -} while (0) -#else /* ! SMP */ #define __get_cpu_var (var) __reloc_hide(var,0)
kernel/module.c +8 -0
@@ -422,6 +422,14 @@ static unsigned int find_pcpusec(Elf_Ehdreturn find_sec (hdr, sechdrs, secstrings,".data.percpu" ); } +static void percpu_modcopy (void *pcpudest,const void *from,unsigned long size) +{ +int cpu; + +for_each_possible_cpu (cpu) +memcpy (pcpudest +per_cpu_offset (cpu), from, size); +} +static int percpu_modinit (void ) { pcpu_num_used =2 ;
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/7] Modules: Fold percpu_modcopy into module.c
Quoted 3 lines · On Saturday 19 January 2008 05:29:54 [email protected] wrote:
percpu_modcopy()is defined multiple times in arch files. However, the only user ismodule.c. Put a static definition intomodule.cand remove the definitions from the arch files.
Thanks!
Rusty.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/7] Modules: Fold percpu_modcopy into module.c
In reply to [email protected]Quoted 8 lines
percpu_modcopy()is defined multiple times in arch files. However, the only user ismodule.c. Put a static definition intomodule.cand remove the definitions from the arch files.Cc Rusty Russell <[email protected]>Cc Andi Kleen <[email protected]>Signed-off-by Christoph Lameter <[email protected]>Signed-off-by Mike Travis <[email protected]>
This doesn't build on sparc64.
The percpu_modcopy() removal from include/asm-sparc64/percpu.h leaked into patch #3 instead of being done here in patch #1 where it belongs (so that this series is properly bisectable).
It also seems that the include/asm-x86/percpu_{32,64}.h defines aren't removed in this patch either.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/7] Modules: Fold percpu_modcopy into module.c
Quoted 12 lines · David Miller
From: [email protected]
Date: Fri, 18 Jan 2008 10:29:54 -0800Quoted 8 lines
percpu_modcopy()is defined multiple times in arch files. However, the only user ismodule.c. Put a static definition intomodule.cand remove the definitions from the arch files.Cc Rusty Russell <[email protected]>Cc Andi Kleen <[email protected]>Signed-off-by Christoph Lameter <[email protected]>Signed-off-by Mike Travis <[email protected]>
Quoted 8 lines
This doesn't build on sparc64.
The
percpu_modcopy()removal frominclude/asm-sparc64/percpu.hleaked into patch #3 instead of being done here in patch #1 where it belongs (so that this series is properly bisectable).It also seems that the
include/asm-x86/percpu_{32,64}.hdefines aren't removed in this patch either.
Hi,
I think I have this fixed in the newest version. Yes, it's been a hat dance with some changes coming through the git-x86 patch and others not. I'll submit the new one shortly.
Thanks,
Mike
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/7 percpu: Change Kconfig ARCH_SETS_UP_PER_CPU_AREA to HAVE_SETUP_PER_CPU_AREA
In reply to [email protected]Change "config ARCH_SETS_UP_PER_CPU_AREA" to "select HAVE_SETUP_PER_CPU_AREA" as suggested by Sam.
--- arch/Kconfig | 3 +++ arch/ia64/Kconfig | 4 +--- arch/powerpc/Kconfig | 4 +--- arch/sparc64/Kconfig | 4 +--- arch/x86/Kconfig | 4 +--- include/asm-generic/percpu.h | 2 +- init/main.c | 4 ++-- 7 files changed, 10 insertions(+), 15 deletions(-)
arch/Kconfig +3 -0
@@ -1,3 +1,6 @@ # # General architecture dependent options # + +config HAVE_SETUP_PER_CPU_AREA + def_bool n
arch/ia64/Kconfig +1 -3
@@ -17,6 +17,7 @@ config IA64 select ARCH_SUPPORTS_MSI select HAVE_OPROFILE select HAVE_KPROBES + select HAVE_SETUP_PER_CPU_AREA default y help The Itanium Processor Family is Intel's 64-bit successor to
@@ -82,9 +83,6 @@ config GENERIC_TIME_VSYSCALL bool default y -config ARCH_SETS_UP_PER_CPU_AREA - def_bool y - config DMI bool default y
arch/powerpc/Kconfig +1 -3
@@ -42,9 +42,6 @@ config GENERIC_HARDIRQS bool default y -config ARCH_SETS_UP_PER_CPU_AREA - def_bool PPC64 - config IRQ_PER_CPU bool default y
@@ -89,6 +86,7 @@ config PPC default y select HAVE_OPROFILE select HAVE_KPROBES + select HAVE_SETUP_PER_CPU_AREA if PPC64 config EARLY_PRINTK bool
arch/sparc64/Kconfig +1 -3
@@ -10,6 +10,7 @@ config SPARC default y select HAVE_OPROFILE select HAVE_KPROBES + select HAVE_SETUP_PER_CPU_AREA config SPARC64 bool
@@ -68,9 +69,6 @@ config AUDIT_ARCH bool default y -config ARCH_SETS_UP_PER_CPU_AREA - def_bool y - config ARCH_NO_VIRT_TO_BUS def_bool y
arch/x86/Kconfig +1 -3
@@ -20,6 +20,7 @@ config X86 def_bool y select HAVE_OPROFILE select HAVE_KPROBES + select HAVE_SETUP_PER_CPU_AREA if X86_64 config GENERIC_LOCKBREAK def_bool n
@@ -106,9 +107,6 @@ config GENERIC_TIME_VSYSCALL bool default X86_64 -config ARCH_SETS_UP_PER_CPU_AREA - def_bool X86_64 - config ARCH_SUPPORTS_OPROFILE bool default y
include/asm-generic/percpu.h +1 -1
@@ -59,7 +59,7 @@ extern unsigned long __per_cpu_offset[NR (*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset)) -#ifdef CONFIG_ARCH_SETS_UP_PER_CPU_AREA +#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA extern void setup_per_cpu_areas (void );#endif
init/main.c +2 -2
@@ -363,7 +363,7 @@ static inline void smp_prepare_cpus(unsi#else -#ifndef CONFIG_ARCH_SETS_UP_PER_CPU_AREA +#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA unsigned long __per_cpu_offset[NR_CPUS ]__read_mostly ;EXPORT_SYMBOL (__per_cpu_offset);
@@ -384,7 +384,7 @@ static void __init setup_per_cpu_areas(v ptr += size; } } -#endif /* CONFIG_ARCH_SETS_UP_CPU_AREA */ +#endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */ /* Called by boot processor to activate the rest. */ static void __init smp_init (void )
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/7 Sparc64: Use generic percpu
In reply to [email protected]Sparc64 has a way of providing the base address for the per cpu area of the currently executing processor in a global register.
Sparc64 also provides a way to calculate the address of a per cpu area from a base address instead of performing an array lookup.
--- arch/sparc64/mm/init.c | 5 +++++ include/asm-sparc64/percpu.h | 22 +++------------------- 2 files changed, 8 insertions(+), 19 deletions(-)
arch/sparc64/mm/init.c +5 -0
@@ -1328,6 +1328,11 @@ pgd_t swapper_pg_dir[2048];static void sun4u_pgprot_init (void );static void sun4v_pgprot_init (void ); +/* Dummy function */ +void __init setup_per_cpu_areas (void ) +{ +} +void __init paging_init (void ) {unsigned long end_pfn, pages_avail, shift, phys_base;
include/asm-sparc64/percpu.h +3 -19
@@ -7,7 +7,6 @@ register unsigned long __local_per_cpu_o#ifdef CONFIG_SMP -#define setup_per_cpu_areas () do { } while (0)extern void real_setup_per_cpu_areas (void );extern unsigned long __per_cpu_base;
@@ -16,29 +15,14 @@ extern unsigned long __per_cpu_shift; (__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift))#define per_cpu_offset (x) (__per_cpu_offset(x)) -/* var is in discarded region: offset to particular copy we want */ -#define per_cpu (var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) -#define __get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset)) -#define __raw_get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset)) - -/* A macro to avoid #include hell... */ -#define percpu_modcopy (pcpudst, src, size) \ -do { \ - unsigned int __i; \ - for_each_possible_cpu(__i) \ - memcpy((pcpudst)+__per_cpu_offset(__i), \ - (src), (size)); \ -} while (0) +#define __my_cpu_offset __local_per_cpu_offset +#else /* ! SMP */ #define real_setup_per_cpu_areas () do { } while (0) -#define per_cpu (var, cpu) (*((void)cpu, &per_cpu__##var)) -#define __get_cpu_var (var) per_cpu__##var -#define __raw_get_cpu_var (var) per_cpu__##var -#endif /* SMP */ -#define DECLARE_PER_CPU (type, name) extern __typeof__(type) per_cpu__##name +#include <asm-generic/percpu.h> #endif /* __ARCH_SPARC64_PERCPU__ */
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/7 ia64: Use generic percpu
In reply to [email protected]ia64 has a special processor specific mapping that can be used to locate the offset for the current per cpu area.
---
V1->V2:
- Merge fixes
- Remove transitional check for PER_CPU_ATTRIBUTES from linux/percpu.h
V2-.V3:
- use generic percpy_modcopy()
--- include/asm-ia64/percpu.h | 24 +++++++----------------- include/linux/percpu.h | 4 ---- 2 files changed, 7 insertions(+), 21 deletions(-)
include/asm-ia64/percpu.h +7 -17
@@ -19,29 +19,14 @@# define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__)))#endif -#define DECLARE_PER_CPU (type, name) \ - extern PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name -#ifdef CONFIG_SMP -extern unsigned long __per_cpu_offset[NR_CPUS ]; -#define per_cpu_offset (x) (__per_cpu_offset[x]) - -/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */ -DECLARE_PER_CPU(unsigned long, local_per_cpu_offset); - -#define per_cpu (var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) -#define __get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset))) -#define __raw_get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset))) +#define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset) -extern void setup_per_cpu_areas (void );extern void *per_cpu_init (void );#else /* ! SMP */ -#define per_cpu (var, cpu) (*((void)(cpu), &per_cpu__##var)) -#define __get_cpu_var (var) per_cpu__##var -#define __raw_get_cpu_var (var) per_cpu__##var#define per_cpu_init () (__phys_per_cpu_start)#endif /* SMP */
@@ -52,7 +37,12 @@ extern void *per_cpu_init(void);* On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly * more efficient. */ -#define __ia64_per_cpu_var (var) (per_cpu__##var) +#define __ia64_per_cpu_var (var) per_cpu__##var + +#include <asm-generic/percpu.h> + +/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */ +DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);#endif /* !__ASSEMBLY__ */
include/linux/percpu.h +0 -4
@@ -9,10 +9,6 @@#include <asm/percpu.h> -#ifndef PER_CPU_ATTRIBUTES -#define PER_CPU_ATTRIBUTES -#endif -#ifdef CONFIG_SMP #define DEFINE_PER_CPU (type, name) \ __attribute__((__section__(".data.percpu"))) \
PATCH 5/7 Powerpc: Use generic per cpu
In reply to [email protected]Powerpc has a way to determine the address of the per cpu area of the currently executing processor via the paca and the array of per cpu offsets is avoided by looking up the per cpu area from the remote paca's (copying x86_64).
---
V1->V2:
- add missing #endif
V2->V3:
- use generic percpy_modcopy()
--- include/asm-powerpc/percpu.h | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
include/asm-powerpc/percpu.h +2 -18
@@ -16,25 +16,9 @@#define __my_cpu_offset () get_paca()->data_offset#define per_cpu_offset (x) (__per_cpu_offset(x)) -/* var is in discarded region: offset to particular copy we want */ -#define per_cpu (var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) -#define __get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) -#define __raw_get_cpu_var (var) (*RELOC_HIDE(&per_cpu__##var, local_paca->data_offset)) +#endif /* CONFIG_SMP */ +#endif /* __powerpc64__ */ -extern void setup_per_cpu_areas (void ); - -#else /* ! SMP */ - -#define per_cpu (var, cpu) (*((void)(cpu), &per_cpu__##var)) -#define __get_cpu_var (var) per_cpu__##var -#define __raw_get_cpu_var (var) per_cpu__##var - -#endif /* SMP */ - -#define DECLARE_PER_CPU (type, name) extern __typeof__(type) per_cpu__##name - -#else #include <asm-generic/percpu.h> -#endif #endif /* _ASM_POWERPC_PERCPU_H_ */
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 6/7 s390: Use generic percpu
In reply to [email protected]Change s390 percpu.h to use asm-generic/percpu.h
---
V2->V3:
Quoted 8 lines · Martin Schwidefsky
Quoted 6 lines · Christoph Lameter
s390 has a special way to determine the pointer to a per cpu area plus there is a way to access the base of the per cpu area of the currently executing processor.
Note: I had to do a minor change to ASM code. Please check that this was done right.
Quoted 6 lines
Hi Christoph,
after fixing the trainwreck with Gregs kset changes I've got rc3-mm2 compiled with your percpu patches. The new s390 percpu code works fine:
--- include/asm-s390/percpu.h | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-)
include/asm-s390/percpu.h +9 -24
@@ -13,40 +13,25 @@*/ #if defined(__s390x__) && defined(MODULE ) -#define __reloc_hide (var,offset) (*({ \ +#define SHIFT_PERCPU_PTR (ptr,offset) (({ \ extern int simple_identifier_##var(void); \ unsigned long *__ptr; \ - asm ( "larl %0,per_cpu__"#var"@GOTENT" \ - : "=a" (__ptr) : "X" (per_cpu__##var) ); \ - (typeof(&per_cpu__##var))((*__ptr) + (offset)); })) + asm ( "larl %0, %1@GOTENT" \ + : "=a" (__ptr) : "X" (ptr) ); \ + (typeof(ptr))((*__ptr) + (offset)); }))#else -#define __reloc_hide (var, offset) (*({ \ +#define SHIFT_PERCPU_PTR (ptr, offset) (({ \ extern int simple_identifier_##var(void); \ unsigned long __ptr; \ - asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \ - (typeof(&per_cpu__##var)) (__ptr + (offset)); })) + asm ( "" : "=a" (__ptr) : "0" (ptr) ); \ + (typeof(ptr)) (__ptr + (offset)); }))#endif -#ifdef CONFIG_SMP +#define __my_cpu_offset S390_lowcore.percpu_offset -extern unsigned long __per_cpu_offset[NR_CPUS ]; - -#define __get_cpu_var (var) __reloc_hide(var,S390_lowcore.percpu_offset) -#define __raw_get_cpu_var (var) __reloc_hide(var,S390_lowcore.percpu_offset) -#define per_cpu (var,cpu) __reloc_hide(var,__per_cpu_offset[cpu]) -#define per_cpu_offset (x) (__per_cpu_offset[x]) - -#else /* ! SMP */ - -#define __get_cpu_var (var) __reloc_hide(var,0) -#define __raw_get_cpu_var (var) __reloc_hide(var,0) -#define per_cpu (var,cpu) __reloc_hide(var,0) - -#endif /* SMP */ - -#define DECLARE_PER_CPU (type, name) extern __typeof__(type) per_cpu__##name +#include <asm-generic/percpu.h> #endif /* __ARCH_S390_PERCPU__ */
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 7/7 percpu: Add debug detection of uninitialized usage of per_cpu variable
In reply to [email protected]Provide a means to trap usages of per_cpu variables before the per_cpu_areas are setup. Define CONFIG_DEBUG_PER_CPU to activate.
--- include/asm-generic/percpu.h | 11 ++++++++++- lib/Kconfig.debug | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
include/asm-generic/percpu.h +10 -1
@@ -47,12 +47,21 @@ extern unsigned long __per_cpu_offset[NR#endif /* -* A percpu variable may point to a discarded reghions. The following are +* A percpu variable may point to a discarded regions. The following are * established ways to produce a usable pointer from the percpu variable * offset. */ +#ifdef CONFIG_DEBUG_PER_CPU +#define per_cpu (var, cpu) (*({ \ + if(!per_cpu_offset(cpu)) { \ + printk("KERN_NOTICE per_cpu(%s,%d): not available!\n", #var, (int)cpu); \ + BUG(); \ + } \ + SHIFT_PERCPU_PTR(&per_cpu_var(var), per_cpu_offset(cpu));})) +#else #define per_cpu (var, cpu) \ (*SHIFT_PERCPU_PTR(&per_cpu_var(var), per_cpu_offset(cpu))) +#endif #define __get_cpu_var (var) \ (*SHIFT_PERCPU_PTR(&per_cpu_var(var), my_cpu_offset))#define __raw_get_cpu_var (var) \
lib/Kconfig.debug +12 -0
@@ -610,6 +610,18 @@ config PROVIDE_OHCI1394_DMA_INIT See Documentation/debugging-via-ohci1394.txt for more information. +config DEBUG_PER_CPU + bool "Debug per_cpu usage" + depends on DEBUG_KERNEL + depends on SMP + default n + help + Say Y here to add code that verifies the per_cpu area is + setup before accessing a per_cpu variable. It does add a + significant amount of code to kernel memory. + + If unsure, say N. + source "samples/Kconfig" source "lib/Kconfig.kgdb"
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · * [email protected] <[email protected]> wrote:
This patchset simplifies the code that arches need to maintain to support per cpu functionality. Most of the code is moved into arch independent code. Only a minimal set of definitions is kept for each arch.
The patch also unifies the x86 arch so that there is only a single
asm-x86/percpu.hBased on: 2.6.24-rc8-mm1
just to make sure i got it right: due to the multi-arch scope of this patchset, this is for -mm, right?
Ingo
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Ingo Molnar
Quoted 8 lines · * [email protected] <[email protected]> wrote:
This patchset simplifies the code that arches need to maintain to support per cpu functionality. Most of the code is moved into arch independent code. Only a minimal set of definitions is kept for each arch.
The patch also unifies the x86 arch so that there is only a single
asm-x86/percpu.h
Quoted 6 lines
Quoted 1 line
Based on: 2.6.24-rc8-mm1
just to make sure i got it right: due to the multi-arch scope of this patchset, this is for -mm, right?
Ingo
Yes, it is.
Thanks,
Mike
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>