2024-01-30 14:53:46

by Paul E. McKenney

[permalink] [raw]
Subject: [PATCH doc] Emphasize that failed atomic operations give no ordering

The ORDERING section of Documentation/atomic_t.txt can easily be read as
saying that conditional atomic RMW operations that fail are ordered when
those operations have the _acquire() or _release() prefixes. This is
not the case, therefore update this section to make it clear that failed
conditional atomic RMW operations provide no ordering.

Reported-by: Anna-Maria Behnsen <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
Cc: Alan Stern <[email protected]>
Cc: Andrea Parri <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Boqun Feng <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: David Howells <[email protected]>
Cc: Jade Alglave <[email protected]>
Cc: Luc Maranget <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: Akira Yokosawa <[email protected]>
Cc: Daniel Lustig <[email protected]>
Cc: Joel Fernandes <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>

diff --git a/Documentation/atomic_t.txt b/Documentation/atomic_t.txt
index d7adc6d543db4..bee3b1bca9a7b 100644
--- a/Documentation/atomic_t.txt
+++ b/Documentation/atomic_t.txt
@@ -171,14 +171,14 @@ The rule of thumb:
- RMW operations that are conditional are unordered on FAILURE,
otherwise the above rules apply.

-Except of course when an operation has an explicit ordering like:
+Except of course when a successful operation has an explicit ordering like:

{}_relaxed: unordered
{}_acquire: the R of the RMW (or atomic_read) is an ACQUIRE
{}_release: the W of the RMW (or atomic_set) is a RELEASE

Where 'unordered' is against other memory locations. Address dependencies are
-not defeated.
+not defeated. Conditional operations are still unordered on FAILURE.

Fully ordered primitives are ordered against everything prior and everything
subsequent. Therefore a fully ordered primitive is like having an smp_mb()


2024-01-30 16:45:32

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH doc] Emphasize that failed atomic operations give no ordering

On Tue, Jan 30, 2024 at 05:02:49PM +0100, Andrea Parri wrote:
> On Tue, Jan 30, 2024 at 06:53:38AM -0800, Paul E. McKenney wrote:
> > The ORDERING section of Documentation/atomic_t.txt can easily be read as
> > saying that conditional atomic RMW operations that fail are ordered when
> > those operations have the _acquire() or _release() prefixes. This is
>
> s/prefixes/suffixes

Good catch, fixed.

> > not the case, therefore update this section to make it clear that failed
> > conditional atomic RMW operations provide no ordering.
> >
> > Reported-by: Anna-Maria Behnsen <[email protected]>
> > Signed-off-by: Paul E. McKenney <[email protected]>
>
> You may want to add a "subsystem" to the subject line, git-log suggests
> "Documentation/atomic_t". Anyway,

Good point, done.

> Acked-by: Andrea Parri <[email protected]>

Thank you!

Thanx, Paul

2024-01-30 17:13:00

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH doc] Emphasize that failed atomic operations give no ordering

On Tue, Jan 30, 2024 at 06:53:38AM -0800, Paul E. McKenney wrote:
> The ORDERING section of Documentation/atomic_t.txt can easily be read as
> saying that conditional atomic RMW operations that fail are ordered when
> those operations have the _acquire() or _release() prefixes. This is
> not the case, therefore update this section to make it clear that failed
> conditional atomic RMW operations provide no ordering.
>
> Reported-by: Anna-Maria Behnsen <[email protected]>
> Signed-off-by: Paul E. McKenney <[email protected]>
> Cc: Alan Stern <[email protected]>
> Cc: Andrea Parri <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Cc: Boqun Feng <[email protected]>
> Cc: Nicholas Piggin <[email protected]>
> Cc: David Howells <[email protected]>
> Cc: Jade Alglave <[email protected]>
> Cc: Luc Maranget <[email protected]>
> Cc: "Paul E. McKenney" <[email protected]>
> Cc: Akira Yokosawa <[email protected]>
> Cc: Daniel Lustig <[email protected]>
> Cc: Joel Fernandes <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: Jonathan Corbet <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
>
> diff --git a/Documentation/atomic_t.txt b/Documentation/atomic_t.txt
> index d7adc6d543db4..bee3b1bca9a7b 100644
> --- a/Documentation/atomic_t.txt
> +++ b/Documentation/atomic_t.txt
> @@ -171,14 +171,14 @@ The rule of thumb:
> - RMW operations that are conditional are unordered on FAILURE,
> otherwise the above rules apply.
>
> -Except of course when an operation has an explicit ordering like:
> +Except of course when a successful operation has an explicit ordering like:
>
> {}_relaxed: unordered
> {}_acquire: the R of the RMW (or atomic_read) is an ACQUIRE
> {}_release: the W of the RMW (or atomic_set) is a RELEASE
>
> Where 'unordered' is against other memory locations. Address dependencies are
> -not defeated.
> +not defeated. Conditional operations are still unordered on FAILURE.
>
> Fully ordered primitives are ordered against everything prior and everything
> subsequent. Therefore a fully ordered primitive is like having an smp_mb()
>

FWIW:

Acked-by: Mark Rutland <[email protected]>

Mark.

2024-01-30 17:59:24

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH doc] Emphasize that failed atomic operations give no ordering

On Tue, Jan 30, 2024 at 05:12:23PM +0000, Mark Rutland wrote:
> On Tue, Jan 30, 2024 at 06:53:38AM -0800, Paul E. McKenney wrote:
> > The ORDERING section of Documentation/atomic_t.txt can easily be read as
> > saying that conditional atomic RMW operations that fail are ordered when
> > those operations have the _acquire() or _release() prefixes. This is
> > not the case, therefore update this section to make it clear that failed
> > conditional atomic RMW operations provide no ordering.
> >
> > Reported-by: Anna-Maria Behnsen <[email protected]>
> > Signed-off-by: Paul E. McKenney <[email protected]>
> > Cc: Alan Stern <[email protected]>
> > Cc: Andrea Parri <[email protected]>
> > Cc: Will Deacon <[email protected]>
> > Cc: Peter Zijlstra <[email protected]>
> > Cc: Boqun Feng <[email protected]>
> > Cc: Nicholas Piggin <[email protected]>
> > Cc: David Howells <[email protected]>
> > Cc: Jade Alglave <[email protected]>
> > Cc: Luc Maranget <[email protected]>
> > Cc: "Paul E. McKenney" <[email protected]>
> > Cc: Akira Yokosawa <[email protected]>
> > Cc: Daniel Lustig <[email protected]>
> > Cc: Joel Fernandes <[email protected]>
> > Cc: Mark Rutland <[email protected]>
> > Cc: Jonathan Corbet <[email protected]>
> > Cc: <[email protected]>
> > Cc: <[email protected]>
> >
> > diff --git a/Documentation/atomic_t.txt b/Documentation/atomic_t.txt
> > index d7adc6d543db4..bee3b1bca9a7b 100644
> > --- a/Documentation/atomic_t.txt
> > +++ b/Documentation/atomic_t.txt
> > @@ -171,14 +171,14 @@ The rule of thumb:
> > - RMW operations that are conditional are unordered on FAILURE,
> > otherwise the above rules apply.
> >
> > -Except of course when an operation has an explicit ordering like:
> > +Except of course when a successful operation has an explicit ordering like:
> >
> > {}_relaxed: unordered
> > {}_acquire: the R of the RMW (or atomic_read) is an ACQUIRE
> > {}_release: the W of the RMW (or atomic_set) is a RELEASE
> >
> > Where 'unordered' is against other memory locations. Address dependencies are
> > -not defeated.
> > +not defeated. Conditional operations are still unordered on FAILURE.
> >
> > Fully ordered primitives are ordered against everything prior and everything
> > subsequent. Therefore a fully ordered primitive is like having an smp_mb()
> >
>
> FWIW:
>
> Acked-by: Mark Rutland <[email protected]>

Applied, thank you!

Thanx, Paul