Re: [patch] spinlocks: remove 'volatile'

From: Linus Torvalds
Date: Sun Jul 09 2006 - 00:21:30 EST




On Sun, 9 Jul 2006, Keith Owens wrote:
>
> "... Extended asm supports input-output or
> read-write operands. Use the constraint character `+' to indicate
> such an operand and list it with the output operands. You should
> only use read-write operands when the constraints for the operand (or
> the operand in which only some of the bits are to be changed) allow a
> register."

Btw, gcc-4.1.1 docs seem to also have this language, although when you
actually go to the "Constraint Modifier Characters" section, that thing
doesn't actually say anything about "only for registers".

It would be good to have the gcc docs fixed. As mentioned, we've been
using "+m" for at least a year (most of our current "+m" usage was there
in 2.6.13), and some of those uses have actually been added by people that
are at least active on the gcc development lists (eg Andi Kleen).

But let's add a few more people who are more deeply involved with gcc.
Jan? Richard? Davem? Who would be the right person to check this out?

We can certainly write

...
:"=m" (*ptr)
:"m" (*ptr)
...

instead of the much simpler

:"+m" (*ptr)

but we've been using that "+m" format for a long time already (and I
_think_ we did so at the suggestion of gcc people), and it would be much
better if the gcc documentation was just fixed here.

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