Re: >= 2.6.30 broken alpha smp build

From: Andrew Morton
Date: Fri Jun 26 2009 - 14:59:28 EST


On Fri, 26 Jun 2009 16:47:05 +0400
Ivan Kokshaysky <ink@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Fri, Jun 26, 2009 at 09:43:22AM +0900, Tejun Heo wrote:
> > The __used attribute is dropped by a patch in percpu patchset as it
> > caused build warning on my test builds and wasn't even effective
> > as-was (overriden by later NULL definition). Ivan, any ideas why it's
> > there?
>
> It was intended for suppressing the compiler warnings about "unused"
> static per-cpu variables, as they were only referenced inside the asm code.
>
> Now it seems to be broken with DECLARE_PER_CPU thing, so I think your
> patch that kills __used attribute should go in as a compile fix ASAP -
> we can live with a few compile warnings until the rest of percpu patchset
> gets merged.
>

OK, we have a wart.


When I do this:

--- a/arch/alpha/include/asm/percpu.h~a
+++ a/arch/alpha/include/asm/percpu.h
@@ -49,7 +49,6 @@ extern unsigned long __per_cpu_offset[NR
: "=&r"(__ptr), "=&r"(tmp_gp)); \
(typeof(&per_cpu_var(var)))(__ptr + (offset)); })

-#define PER_CPU_ATTRIBUTES __used

#endif /* MODULE */

_


I get

In file included from include/linux/sched.h:89,
from /usr/src/devel/arch/alpha/include/asm/uaccess.h:5,
from arch/alpha/kernel/srm_env.c:37:
include/linux/hrtimer.h:314: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typeof'
In file included from /usr/src/devel/arch/alpha/include/asm/uaccess.h:5,
from arch/alpha/kernel/srm_env.c:37:
include/linux/sched.h:138: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typeof'


But hrtimer.h correctly includes percpu.h. I would have expected the
above patch to fix the build.

The reason for it not fixing the build is that this:

#ifndef PER_CPU_ATTRIBUTES
#define PER_CPU_ATTRIBUTES
#endif

is in asm-generic/percpu.h, which alpha does not use.

Would it not have been better to put the above three lines into
linux/percpu.h so that alpha's asm/percpu.h doesn't need to define
PER_CPU_ATTRIBUTES at all?


Ho hum. Anyway, we need a backportable fix, so I'll put this through
some build testing:

--- a/arch/alpha/include/asm/percpu.h~a
+++ a/arch/alpha/include/asm/percpu.h
@@ -49,7 +49,7 @@ extern unsigned long __per_cpu_offset[NR
: "=&r"(__ptr), "=&r"(tmp_gp)); \
(typeof(&per_cpu_var(var)))(__ptr + (offset)); })

-#define PER_CPU_ATTRIBUTES __used
+#define PER_CPU_ATTRIBUTES

#endif /* MODULE */

_

--
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/