]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] __cmpxchg() must really always be inlined
authorSteve Langasek <vorlon@debian.org>
Wed, 8 Feb 2006 06:24:17 +0000 (07:24 +0100)
committerChris Wright <chrisw@sous-sol.org>
Fri, 10 Feb 2006 07:20:17 +0000 (23:20 -0800)
With the latest 2.6.15 kernel builds for alpha on Debian, we ran into a
problem with undefined references to __cmpxchg_called_with_bad_pointer() in
a couple of kernel modules (xfs.ko and drm.ko; see
http://bugs.debian.org/347556).

It looks like people have been trying to out-clever each other wrt the
definition of "inline" on this architecture :), with the result that
__cmpxchg(), which must be inlined so the compiler can see its argument is
const, is not guaranteed to be inlined.  Indeed, it was not being inlined
when building with -Os.

The attached patch fixes the issue by adding an
__attribute__((always_inline)) explicitly to the definition of __cmpxchg()
instead of relying on redefines of "inline" elsewhere to make this happen.

Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/asm-alpha/system.h

index 050e86d12891ef704762adba37cabe4a5cb19fe4..1f75e4de5db36005c52167bdc74e30340527fc71 100644 (file)
@@ -562,7 +562,7 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
    if something tries to do an invalid cmpxchg().  */
 extern void __cmpxchg_called_with_bad_pointer(void);
 
-static inline unsigned long
+static __always_inline unsigned long
 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
 {
        switch (size) {