提交 a875a69f 编写于 作者: I Ingo Molnar 提交者: Linus Torvalds

[PATCH] lockdep: add per_cpu_offset()

Add the per_cpu_offset() generic method. (used by the lock validator)
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 8d8fdf5c
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
extern unsigned long __per_cpu_offset[NR_CPUS]; extern unsigned long __per_cpu_offset[NR_CPUS];
#define per_cpu_offset(x) (__per_cpu_offset[x])
/* Separate out the type, so (int[3], foo) works. */ /* Separate out the type, so (int[3], foo) works. */
#define DEFINE_PER_CPU(type, name) \ #define DEFINE_PER_CPU(type, name) \
__attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
extern unsigned long __per_cpu_offset[NR_CPUS]; 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: */ /* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
DECLARE_PER_CPU(unsigned long, local_per_cpu_offset); DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#define __per_cpu_offset(cpu) (paca[cpu].data_offset) #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))
/* Separate out the type, so (int[3], foo) works. */ /* Separate out the type, so (int[3], foo) works. */
#define DEFINE_PER_CPU(type, name) \ #define DEFINE_PER_CPU(type, name) \
......
...@@ -42,6 +42,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; ...@@ -42,6 +42,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset) #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 __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(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
#define per_cpu_offset(x) (__per_cpu_offset[x])
/* A macro to avoid #include hell... */ /* A macro to avoid #include hell... */
#define percpu_modcopy(pcpudst, src, size) \ #define percpu_modcopy(pcpudst, src, size) \
......
...@@ -11,6 +11,7 @@ extern unsigned long __per_cpu_base; ...@@ -11,6 +11,7 @@ extern unsigned long __per_cpu_base;
extern unsigned long __per_cpu_shift; extern unsigned long __per_cpu_shift;
#define __per_cpu_offset(__cpu) \ #define __per_cpu_offset(__cpu) \
(__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift)) (__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift))
#define per_cpu_offset(x) (__per_cpu_offset(x))
/* Separate out the type, so (int[3], foo) works. */ /* Separate out the type, so (int[3], foo) works. */
#define DEFINE_PER_CPU(type, name) \ #define DEFINE_PER_CPU(type, name) \
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
#define __my_cpu_offset() read_pda(data_offset) #define __my_cpu_offset() read_pda(data_offset)
#define per_cpu_offset(x) (__per_cpu_offset(x))
/* Separate out the type, so (int[3], foo) works. */ /* Separate out the type, so (int[3], foo) works. */
#define DEFINE_PER_CPU(type, name) \ #define DEFINE_PER_CPU(type, name) \
__attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册