Re: PATCH] cpuidle: A new variant of the menu governor to boost IOperformance

From: Peter Zijlstra
Date: Mon Sep 14 2009 - 04:16:34 EST


On Mon, 2009-09-14 at 17:04 +0900, Tejun Heo wrote:
> Andrew Morton wrote:
> > This fails to compile in linux-next:
> >
> > drivers/cpuidle/governors/menu-tng.o:(.discard+0x0): multiple definition of `__pcpu_unique_menu_devices'
> > drivers/cpuidle/governors/menu.o:(.discard+0x0): first defined here
> >
> > because we have
> >
> > static DEFINE_PER_CPU(struct menu_device, menu_devices);
> >
> > in both menu.c and menu-tng.c.
> >
> > Despite the `static', the percpu changes in
> >
> > commit 7c756e6e19e71f0327760d8955f7077118ebb2b1
> > Author: Tejun Heo <tj@xxxxxxxxxx>
> > AuthorDate: Wed Jun 24 15:13:50 2009 +0900
> > Commit: Tejun Heo <tj@xxxxxxxxxx>
> > CommitDate: Wed Jun 24 15:13:50 2009 +0900
> >
> > percpu: implement optional weak percpu definitions
> >
> > are emitting global symbol derived from `menu_devices' and they clash.
> >
> > I'll rename menu_devices to fix that up, but we have a problem...
>
> Unfortunately, this was the only way we could come up with to get
> alpha and s390 working with the new percpu allocator. On other archs,
> the global definition isn't necessary but config option
> DEBUG_FORCE_WEAK_PER_CPU enables it so that alpha and s390 don't choke
> on generic code later.
>
> The core of the problem is that the memory model used by gcc on those
> two archs assume that static symbols are reachable with small offset
> but percpu variables, static or not, always end up way away. Making
> all percpu variables weak and using global symbols to enforce global
> uniqueness works around the problem but with the side effect you're
> seeing.
>
> If someone has any better ideas, I would happy to remove the annoying
> restriction.

That sounds like a variable __attribute__((no-explicit-relocs)) should
be proposed to the GCC folks or something. Then we can at least have a
hope of lifting this restriction some time in the future.

(Alternatively we build the full alpha kernel with
--mno-explicit-relocs, but that would be sub-optimal as well)

Not sure if s390 has anything similar..

Alternatively we could file it as a bug, since the symbols are in a
custom .section, which is a strong indication we're going to play funny
games anyway.

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