Re: [patch] spinlocks: remove 'volatile'

Linus Torvalds
2006-07-09T03:59:13Z

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