Re: [PATCH] parisc: fix module loading failure of large kernel modules (take 4)

Ingo Molnar
2009-01-01T14:25:12Z

* Linus Torvalds <torvalds@linux-foundation.org> wrote:

>
>
> On Wed, 31 Dec 2008, Andrew Morton wrote:
> >
> > Adrian claimed that it was gcc-4.1.0 and 4.1.1 only. He proposed
> > banning them: http://lkml.org/lkml/2008/8/5/444
>
> If it really is just those releases, then yes, considering the number of
> cases we apparently have, and considering how ugly it is in some cases
> to move the weak function anywhere else, maybe banning those versions is
> the proper thing to do.
>
> It probably won't hurt very many people - yeah, some people will be
> forced to upgrade, but I have this memory of early 4.1 having had other
> bugs anyway, so it's probably a good idea.

That would be _really_ nice to do IMHO: in many cases putting the __weak
definition into same-file scope with a call site is a natural approach. I
think that's how we ended up having so many instances of that bug. When
you use __weak as a 'default implementation' for some function, then it's
very natural to put it into the same file that also uses it.

It goes into separate, inactive scope only in a few special cases: such as
when it's some library function that can be overriden by the architecture.
But if it's some non-libray kernel code then the usage site is close to
the definition site.

If you look at most of the __weak fixes they IMO actually turned clean
code into less clean code: they detached some natural clustering of
definition and callsite.

And __weak is very elegant IMO, it can avoid a lot of #ifdefs and can be
used to self-document architecture interfaces - so it would be nice to
make it always work, regardless of the callsite's scope.

Ingo