Re: [PATCH 10/23] make atomic_read() and atomic_set() behavior consistenton ia64

From: Chris Snook
Date: Tue Aug 14 2007 - 14:50:41 EST


Luck, Tony wrote:
Use volatile consistently in atomic.h on ia64.
This will do weird things without Andreas Schwab's fix:
http://lkml.org/lkml/2007/8/10/410

The build is very noisy with the inline versions of atomic_{read,set}
and their 64-bit siblings. Here are the prime culprits (some of them
repeat >100 times).

Part of the motivation for using inline functions was to expose places where we've been lazy, so this isn't unexpected. We need to work on clearing up those callers.

include/linux/skbuff.h:521: warning: passing arg 1 of `atomic_read' discards qualifiers from pointer target type
include/net/sock.h:1244: warning: passing arg 1 of `atomic_read' discards qualifiers from pointer target type
include/net/tcp.h:958: warning: passing arg 1 of `atomic_read' discards qualifiers from pointer target type
mm/slub.c:3115: warning: passing arg 1 of `atomic_read' from incompatible pointer type
mm/slub.c:3250: warning: passing arg 1 of `atomic_read' from incompatible pointer type
mm/slub.c:3286: warning: passing arg 1 of `atomic_read' from incompatible pointer type

Do you get any warnings other than those two?

The inline versions also result in some structural changes in
the object file that make it difficult to compare with the
original. Text size is 96 bytes smaller ... but even after
I use sed(1) to exclude the most obvious instructions that
differ, I still find big blocks of code with changes. Perhaps
even more surprising there are entire functions that are
optimized out in either the 'before' or 'after' binary.
E.g. lookup_pi_state() was optimized away (or completely
inlined?) before this patch, but the function appears as
standalone in the 'after' version. The reverse is true for
fixup_pi_state_owner().

IIRC, when you applied a version which used macros instead, there was no change. It would seem that inlining changed the optimization behavior of the compiler. If you turn down the optimization level, do the macro and inline versions look the same, or at least more similar?

The binary does boot ... but I haven't run any tests to see whether
there are any problems.

The only part of the patch that I was really worried about breaking anything was the removal of the volatile declaration, in case there was some other access that needed a cast. Since the macro version didn't change anything, that's covered. Converting from a macro to an inline shouldn't really change anything in this case, except perhaps for how the compiler optimizes it. If something *does* break, I'd suspect compiler bugs.

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