Re: [PATCH kcsan 6/9] tools/memory-model: Expand the cheatsheet.txt notion of relaxed

From: Boqun Feng
Date: Thu Sep 03 2020 - 22:47:36 EST


On Thu, Sep 03, 2020 at 07:39:55PM -0700, Paul E. McKenney wrote:
> On Fri, Sep 04, 2020 at 08:59:21AM +0800, Boqun Feng wrote:
> > On Thu, Sep 03, 2020 at 04:30:37PM -0700, Paul E. McKenney wrote:
>
> [ . . . ]
>
> > > How about like this, adding "Relaxed" to the WRITE_ONCE() and READ_ONCE()
> > > rows and "RMW" to the "Relaxed operation" row?
> > >
> >
> > Much better now, thanks! However ...
> >
> > > The file contents are followed by a diff against the previous version.
> > >
> > > Thanx, Paul
> > >
> > > ------------------------------------------------------------------------
>
> [ . . . ]
>
> > > Key: Relaxed: A relaxed operation is either a *_relaxed() RMW
> > > operation, an unsuccessful RMW operation, READ_ONCE(),
> > > WRITE_ONCE(), or one of the atomic_read() and
> > > atomic_set() family of operations.
> >
> > And:
> > a RMW operation that doesn't return any value (e.g
> > atomic_inc()), IOW it's a void Relaxed operation.
>
> Good point! Please see below.
>

Looks good to me ;-)


Acked-by: Boqun Feng <boqun.feng@xxxxxxxxx>


Regards,
Boqun

> Thanx, Paul
>
> ------------------------------------------------------------------------
>
> Prior Operation Subsequent Operation
> --------------- ---------------------------
> C Self R W RMW Self R W DR DW RMW SV
> -- ---- - - --- ---- - - -- -- --- --
>
> Relaxed store Y Y
> Relaxed load Y Y Y Y
> Relaxed RMW operation Y Y Y Y
> rcu_dereference() Y Y Y Y
> Successful *_acquire() R Y Y Y Y Y Y
> Successful *_release() C Y Y Y W Y
> smp_rmb() Y R Y Y R
> smp_wmb() Y W Y Y W
> smp_mb() & synchronize_rcu() CP Y Y Y Y Y Y Y Y
> Successful full non-void RMW CP Y Y Y Y Y Y Y Y Y Y Y
> smp_mb__before_atomic() CP Y Y Y a a a a Y
> smp_mb__after_atomic() CP a a Y Y Y Y Y Y
>
>
> Key: Relaxed: A relaxed operation is either READ_ONCE(), WRITE_ONCE(),
> a *_relaxed() RMW operation, an unsuccessful RMW
> operation, a non-value-returning RMW operation such
> as atomic_inc(), or one of the atomic*_read() and
> atomic*_set() family of operations.
> C: Ordering is cumulative
> P: Ordering propagates
> R: Read, for example, READ_ONCE(), or read portion of RMW
> W: Write, for example, WRITE_ONCE(), or write portion of RMW
> Y: Provides ordering
> a: Provides ordering given intervening RMW atomic operation
> DR: Dependent read (address dependency)
> DW: Dependent write (address, data, or control dependency)
> RMW: Atomic read-modify-write operation
> SELF: Orders self, as opposed to accesses before and/or after
> SV: Orders later accesses to the same variable
>
> ------------------------------------------------------------------------
>
> diff --git a/tools/memory-model/Documentation/cheatsheet.txt b/tools/memory-model/Documentation/cheatsheet.txt
> index 4146b8d..99d0087 100644
> --- a/tools/memory-model/Documentation/cheatsheet.txt
> +++ b/tools/memory-model/Documentation/cheatsheet.txt
> @@ -17,10 +17,11 @@ smp_mb__before_atomic() CP Y Y Y a a a a Y
> smp_mb__after_atomic() CP a a Y Y Y Y Y Y
>
>
> -Key: Relaxed: A relaxed operation is either a *_relaxed() RMW
> - operation, an unsuccessful RMW operation, READ_ONCE(),
> - WRITE_ONCE(), or one of the atomic_read() and
> - atomic_set() family of operations.
> +Key: Relaxed: A relaxed operation is either READ_ONCE(), WRITE_ONCE(),
> + a *_relaxed() RMW operation, an unsuccessful RMW
> + operation, a non-value-returning RMW operation such
> + as atomic_inc(), or one of the atomic*_read() and
> + atomic*_set() family of operations.
> C: Ordering is cumulative
> P: Ordering propagates
> R: Read, for example, READ_ONCE(), or read portion of RMW