]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.30.2/alpha-fix-percpu-build-breakage.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 2.6.30.2 / alpha-fix-percpu-build-breakage.patch
1 From b01e8dc34379f4ba2f454390e340a025edbaaa7e Mon Sep 17 00:00:00 2001
2 From: Tejun Heo <tj@kernel.org>
3 Date: Tue, 30 Jun 2009 11:41:18 -0700
4 Subject: alpha: fix percpu build breakage
5
6 From: Tejun Heo <tj@kernel.org>
7
8 commit b01e8dc34379f4ba2f454390e340a025edbaaa7e upstream.
9
10 alpha percpu access requires custom SHIFT_PERCPU_PTR() definition for
11 modules to work around addressing range limitation. This is done via
12 generating inline assembly using C preprocessing which forces the
13 assembler to generate external reference. This happens behind the
14 compiler's back and makes the compiler think that static percpu variables
15 in modules are unused.
16
17 This used to be worked around by using __unused attribute for percpu
18 variables which prevent the compiler from omitting the variable; however,
19 recent declare/definition attribute unification change broke this as
20 __used can't be used for declaration. Also, in the process,
21 PER_CPU_ATTRIBUTES definition in alpha percpu.h got broken.
22
23 This patch adds PER_CPU_DEF_ATTRIBUTES which is only used for definitions
24 and make alpha use it to add __used for percpu variables in modules. This
25 also fixes the PER_CPU_ATTRIBUTES double definition bug.
26
27 Signed-off-by: Tejun Heo <tj@kernel.org>
28 Tested-by: maximilian attems <max@stro.at>
29 Acked-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
30 Cc: Richard Henderson <rth@twiddle.net>
31 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
32 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
33 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
34
35 ---
36 arch/alpha/include/asm/percpu.h | 6 +++---
37 include/asm-generic/percpu.h | 4 ++++
38 include/linux/percpu-defs.h | 3 ++-
39 3 files changed, 9 insertions(+), 4 deletions(-)
40
41 --- a/arch/alpha/include/asm/percpu.h
42 +++ b/arch/alpha/include/asm/percpu.h
43 @@ -30,7 +30,7 @@ extern unsigned long __per_cpu_offset[NR
44
45 #ifndef MODULE
46 #define SHIFT_PERCPU_PTR(var, offset) RELOC_HIDE(&per_cpu_var(var), (offset))
47 -#define PER_CPU_ATTRIBUTES
48 +#define PER_CPU_DEF_ATTRIBUTES
49 #else
50 /*
51 * To calculate addresses of locally defined variables, GCC uses 32-bit
52 @@ -49,7 +49,7 @@ extern unsigned long __per_cpu_offset[NR
53 : "=&r"(__ptr), "=&r"(tmp_gp)); \
54 (typeof(&per_cpu_var(var)))(__ptr + (offset)); })
55
56 -#define PER_CPU_ATTRIBUTES __used
57 +#define PER_CPU_DEF_ATTRIBUTES __used
58
59 #endif /* MODULE */
60
61 @@ -71,7 +71,7 @@ extern unsigned long __per_cpu_offset[NR
62 #define __get_cpu_var(var) per_cpu_var(var)
63 #define __raw_get_cpu_var(var) per_cpu_var(var)
64
65 -#define PER_CPU_ATTRIBUTES
66 +#define PER_CPU_DEF_ATTRIBUTES
67
68 #endif /* SMP */
69
70 --- a/include/asm-generic/percpu.h
71 +++ b/include/asm-generic/percpu.h
72 @@ -97,4 +97,8 @@ extern void setup_per_cpu_areas(void);
73 #define PER_CPU_ATTRIBUTES
74 #endif
75
76 +#ifndef PER_CPU_DEF_ATTRIBUTES
77 +#define PER_CPU_DEF_ATTRIBUTES
78 +#endif
79 +
80 #endif /* _ASM_GENERIC_PERCPU_H_ */
81 --- a/include/linux/percpu-defs.h
82 +++ b/include/linux/percpu-defs.h
83 @@ -24,7 +24,8 @@
84
85 #define DEFINE_PER_CPU_SECTION(type, name, section) \
86 __attribute__((__section__(PER_CPU_BASE_SECTION section))) \
87 - PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
88 + PER_CPU_ATTRIBUTES PER_CPU_DEF_ATTRIBUTES \
89 + __typeof__(type) per_cpu__##name
90
91 /*
92 * Variant on the per-CPU variable declaration/definition theme used for