Re: [PATCH] alpha: fix module load failures on smp (bug #10926)

From: Thorsten Kranzkowski
Date: Mon Jun 23 2008 - 17:23:23 EST


On Sat, Jun 21, 2008 at 03:25:39AM +0400, Ivan Kokshaysky wrote:
> To calculate addresses of locally defined variables, GCC uses 32-bit
> displacement from the GP. Which doesn't work for per cpu variables in
> modules, as an offset to the kernel per cpu area is way above 4G.
>
> The workaround is to force allocation of a GOT entry for per cpu variable
> using ldq instruction with a 'literal' relocation.
> I had to use custom asm/percpu.h, as a required argument magic doesn't
> work with asm-generic/percpu.h macros.
>
> Signed-off-by: Ivan Kokshaysky <ink@xxxxxxxxxxxxxxxxxxxx>
> ---
> include/asm-alpha/percpu.h | 72 +++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 71 insertions(+), 1 deletions(-)


This causes a regression for my ev4 uniprocessor build:


CC arch/alpha/mm/init.o
/export/data/repositories/linux-2.6/arch/alpha/mm/init.c:34: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âtypeofâ
make[2]: *** [arch/alpha/mm/init.o] Error 1
make[1]: *** [arch/alpha/mm] Error 2
make: *** [sub-make] Error 2


This patch fixes it for me (compile and boot tested):


diff --git a/include/asm-alpha/percpu.h b/include/asm-alpha/percpu.h
index 82e8a94..3495e8e 100644
--- a/include/asm-alpha/percpu.h
+++ b/include/asm-alpha/percpu.h
@@ -69,6 +69,8 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
#define __get_cpu_var(var) per_cpu_var(var)
#define __raw_get_cpu_var(var) per_cpu_var(var)

+#define PER_CPU_ATTRIBUTES
+
#endif /* SMP */

#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu_var(name)


Signed-off-by: Thorsten Kranzkowski <dl8bcu@xxxxxxxxx>

Thorsten.

--
| Thorsten Kranzkowski Internet: dl8bcu@xxxxxxxxx |
| Mobile: ++49 170 1876134 Snail: Kiebitzstr. 14, 49324 Melle, Germany |
| Ampr: dl8bcu@db0lj.#rpl.deu.eu, dl8bcu@xxxxxxxxxxxxxxxxxxxxxx [44.130.8.19] |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/