From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: "David S. Miller" <davem@davemloft.net>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
linux-kernel@vger.kernel.org,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: sparc64 cmpxchg is not a full memory barrier anymore ?
Date: Thu, 22 Oct 2009 14:32:42 -0400 [thread overview]
Message-ID: <20091022183242.GA19307@Krystal> (raw)
Hi David,
I took a look at the current sparc64 cmpxchg implementation in the Linux
kernel and stumbled on this commit:
commit 293666b7a17cb7a389fc274980439212386a19c4
Author: David S. Miller <davem@davemloft.net>
Date: Sat Nov 15 13:33:25 2008 -0800
sparc64: Stop using memory barriers for atomics and locks.
The kernel always executes in the TSO memory model now,
so none of this stuff is necessary any more.
With helpful feedback from Nick Piggin.
Signed-off-by: David S. Miller <davem@davemloft.net>
Reading p. 152 A.9 Compare and Swap, I see that the cas instruction does
not imply a memory barrier.
Reading http://docs.sun.com/app/docs/doc/801-6678/6i11oelck?a=view
I see that:
"TSO guarantees that the store, FLUSH, and atomic load-store
instructions of all processors appear to be executed by memory serially
in a single order called the memory order. Furthermore, the sequence of
store, FLUSH, and atomic load-store instructions in the memory order for
a given processor is identical to the sequence in which they were issued
by the processor."
So it provides no guarantee whatsoever wrt loads. However, reading
Documentation/memory-barriers.txt:
"Whilst they are technically interprocessor interaction considerations,
atomic operations are noted specially as some of them imply full memory
barriers and some don't, but they're very heavily relied on as a group
throughout the kernel." -> cmpxchg is part of them.
The same applies to the other atomic instructions we find in this list.
How is the correct ordering of loads wrt to cmxchg (and other atomic
ops) still ensured by this modification?
Thanks,
Mathieu
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next reply other threads:[~2009-10-22 18:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-22 18:32 Mathieu Desnoyers [this message]
2009-10-22 19:57 ` Sparc64 support added to Userspace RCU Mathieu Desnoyers
2009-11-16 4:31 ` David Miller
2009-11-16 20:27 ` Mathieu Desnoyers
2009-10-22 21:56 ` sparc64 cmpxchg is not a full memory barrier anymore ? David Miller
2009-10-23 12:33 ` Mathieu Desnoyers
2009-10-23 14:19 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091022183242.GA19307@Krystal \
--to=mathieu.desnoyers@polymtl.ca \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=paulmck@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox