diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 5a41e75ae1fefd1d9358917255a3d3b22041d073..c9307c99a1dc26977399b955f9436f9898afca72 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -80,7 +80,7 @@ config GENERIC_TIME_VSYSCALL bool default y -config ARCH_SETS_UP_PER_CPU_AREA +config HAVE_SETUP_PER_CPU_AREA def_bool y config DMI diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c index e699eb6c44be0f788397ba0300bac77800db1767..e58f4367cf11db4ad4cca80fed0785f7283d5b15 100644 --- a/arch/ia64/kernel/module.c +++ b/arch/ia64/kernel/module.c @@ -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 */ diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index fb85f6b72fcfa4931f1ab14d574e32ddc3dea2dd..bb16443b6817b95390df4051bef4977f801b8bba 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -42,7 +42,7 @@ config GENERIC_HARDIRQS bool default y -config ARCH_SETS_UP_PER_CPU_AREA +config HAVE_SETUP_PER_CPU_AREA def_bool PPC64 config IRQ_PER_CPU diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 26f5791baa33c7beb4a7264fd655310337bfd977..73fc05d0bfad4aa9662bd27e5b63da23527800ae 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig @@ -66,7 +66,7 @@ config AUDIT_ARCH bool default y -config ARCH_SETS_UP_PER_CPU_AREA +config HAVE_SETUP_PER_CPU_AREA def_bool y config ARCH_NO_VIRT_TO_BUS diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index fbeb55d71e769a116f01a326b708144c3b1e0c54..523e993ee90ca3b46652376a2b3e792b1b462f7d 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -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; diff --git a/arch/x86/kernel/test_nx.c b/arch/x86/kernel/test_nx.c index 6d7ef11e79757610caac0814e1a683c9558f4bd6..ae0ef2e304c72e60ff218fed26080f5645a7d029 100644 --- a/arch/x86/kernel/test_nx.c +++ b/arch/x86/kernel/test_nx.c @@ -91,8 +91,13 @@ static noinline int test_address(void *address) ".previous\n" ".section __ex_table,\"a\"\n" " .align 8\n" +#ifdef CONFIG_X86_32 + " .long 0b\n" + " .long 2b\n" +#else " .quad 0b\n" " .quad 2b\n" +#endif ".previous\n" : [rslt] "=r" (result) : [fake_code] "r" (address), [zero] "r" (0UL), "0" (result) diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index 8bab2b2efaff86c2707ccc929b996f5a245cecd5..9c4ffd5bedb299ddaba538d460bd51cfb0bd8cc8 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c @@ -817,6 +817,7 @@ unsigned long __copy_from_user_ll_nocache(void *to, const void __user *from, #endif return n; } +EXPORT_SYMBOL(__copy_from_user_ll_nocache); unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *from, unsigned long n) @@ -831,6 +832,7 @@ unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *fr #endif return n; } +EXPORT_SYMBOL(__copy_from_user_ll_nocache_nozero); /** * copy_to_user: - Copy a block of data into user space. diff --git a/include/asm-alpha/tlbflush.h b/include/asm-alpha/tlbflush.h index eefab3fb51ae87f76050c34118fabe6d31c87078..b9e9147226f770ba3bc09149375984b525f066c7 100644 --- a/include/asm-alpha/tlbflush.h +++ b/include/asm-alpha/tlbflush.h @@ -3,6 +3,7 @@ #include #include +#include #ifndef __EXTERN_INLINE #define __EXTERN_INLINE extern inline diff --git a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h index 0095bcf798484d0988ff086bc0c5d0a167cd08ab..77f30b664b4eade81ca0985be35d97825fe0a3a8 100644 --- a/include/asm-ia64/percpu.h +++ b/include/asm-ia64/percpu.h @@ -15,38 +15,20 @@ #include +#ifdef CONFIG_SMP + #ifdef HAVE_MODEL_SMALL_ATTRIBUTE # define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__))) #endif -#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]; -#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 __my_cpu_offset __ia64_per_cpu_var(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))) - -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); #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_ATTRIBUTES __attribute__((__section__(".data.percpu"))) + #define per_cpu_init() (__phys_per_cpu_start) #endif /* SMP */ @@ -57,7 +39,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 + +/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */ +DECLARE_PER_CPU(unsigned long, local_per_cpu_offset); #endif /* !__ASSEMBLY__ */ diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h index cc1cbf656b02f343e60199c79ec50fb26cb53665..ccb0523eb3b47d32192ef4f00304e3000691f8e5 100644 --- a/include/asm-powerpc/percpu.h +++ b/include/asm-powerpc/percpu.h @@ -13,37 +13,12 @@ #include #define __per_cpu_offset(cpu) (paca[cpu].data_offset) -#define __my_cpu_offset() get_paca()->data_offset +#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__ */ -/* 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 */ - -#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 -#endif #endif /* _ASM_POWERPC_PERCPU_H_ */ diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h index 2d676a873858cf599fbc1b679e6ceccd6a112fc3..408d60b4f75bc779a5bf356d13c1624ba209ce25 100644 --- a/include/asm-s390/percpu.h +++ b/include/asm-s390/percpu.h @@ -13,49 +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]) - -/* 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) -#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 #endif /* __ARCH_S390_PERCPU__ */ diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h index c7e52decba9863e5e821872d293f6f79b4fc7ec2..bee64593023e2f34d0be046dcddd47d5e3167e60 100644 --- a/include/asm-sparc64/percpu.h +++ b/include/asm-sparc64/percpu.h @@ -7,7 +7,6 @@ register unsigned long __local_per_cpu_offset asm("g5"); #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 #endif /* __ARCH_SPARC64_PERCPU__ */ diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h index 9b531ea015a83a491ed810acaaed074c6069a76b..6c9b214b8fc3481c3f58ca784d3b6ba67e7a5610 100644 --- a/include/asm-x86/thread_info_64.h +++ b/include/asm-x86/thread_info_64.h @@ -123,8 +123,8 @@ static inline struct thread_info *stack_thread_info(void) #define TIF_FREEZE 23 /* is freezing for suspend */ #define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ #define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */ -#define TIF_DS_AREA_MSR 25 /* uses thread_struct.ds_area_msr */ -#define TIF_BTS_TRACE_TS 26 /* record scheduling event timestamps */ +#define TIF_DS_AREA_MSR 26 /* uses thread_struct.ds_area_msr */ +#define TIF_BTS_TRACE_TS 27 /* record scheduling event timestamps */ #define _TIF_SYSCALL_TRACE (1< -#ifndef PER_CPU_ATTRIBUTES -#define PER_CPU_ATTRIBUTES -#endif - #ifdef CONFIG_SMP #define DEFINE_PER_CPU(type, name) \ __attribute__((__section__(".data.percpu"))) \