Re: [PATCH] memory-model: fix cheat sheet typo

From: Paul E. McKenney
Date: Tue Apr 10 2018 - 16:31:23 EST


On Mon, Apr 09, 2018 at 11:42:58AM -0700, Paul E. McKenney wrote:
> On Mon, Apr 09, 2018 at 06:50:15PM +0200, Paolo Bonzini wrote:
> > "RWM" should be "RMW", and that's more or less the extent to which I
> > can claim to change the document. :) In particular, "Self" is not
> > documented and the difference between "Self" and "SV" is not clear
> > to me.
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
>
> Applied, though without the questions. ;-)
>
> "Self" is for things like smp_load_acquire() and smp_store_release()
> that order themselves against later and earlier accesses, respectively.
> This ordering applies to later/earlier access to all variables, not
> just the one that smp_load_acquire()/smp_store_release() accessed.
> In contrast, things like smp_mb() order only other accesses, not
> themselves. Or at least it is impossible to proves whether or not they
> order themselves because they are not separately visible to other CPUs.
>
> "SV" is "same variable", which applies to pretty much anything that
> accesses a variable, but not to things like smp_mb() which do not.
>
> Does that help?

On the perhaps naive assumption that silence means assent, how about
the following patch?

Thanx, Paul

------------------------------------------------------------------------

commit 818e46e8db6cacb099b8640b7f2945a3151c00ab
Author: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Date: Tue Apr 10 13:24:19 2018 -0700

tools/memory-order: Improve key for SELF and SV

The key for "SELF" was missing completely and the key for "SV" was
a bit obtuse. This commit therefore adds a key for "SELF" and improves
the one for "SV".

Reported-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>

diff --git a/tools/memory-model/Documentation/cheatsheet.txt b/tools/memory-model/Documentation/cheatsheet.txt
index c0eafdaddfa4..d502993ac7d2 100644
--- a/tools/memory-model/Documentation/cheatsheet.txt
+++ b/tools/memory-model/Documentation/cheatsheet.txt
@@ -26,4 +26,5 @@ Key: C: Ordering is cumulative
DR: Dependent read (address dependency)
DW: Dependent write (address, data, or control dependency)
RMW: Atomic read-modify-write operation
- SV Same-variable access
+ SELF: Orders self, as opposed to accesses both before and after
+ SV: Orders later accesses to the same variable