Skip to content
Snippets Groups Projects
  1. May 06, 2024
    • Paul E. McKenney's avatar
      Documentation/atomic_t: Emphasize that failed atomic operations give no ordering · d372e204
      Paul E. McKenney authored
      
      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() suffixes.  This is
      not the case, therefore update this section to make it clear that failed
      conditional atomic RMW operations provide no ordering.
      
      Reported-by: default avatarAnna-Maria Behnsen <anna-maria@linutronix.de>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Will Deacon <will@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Jade Alglave <j.alglave@ucl.ac.uk>
      Cc: Luc Maranget <luc.maranget@inria.fr>
      Cc: "Paul E. McKenney" <paulmck@kernel.org>
      Cc: Akira Yokosawa <akiyks@gmail.com>
      Cc: Daniel Lustig <dlustig@nvidia.com>
      Cc: Joel Fernandes <joel@joelfernandes.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: <linux-arch@vger.kernel.org>
      Cc: <linux-doc@vger.kernel.org>
      Acked-by: default avatarAndrea Parri <parri.andrea@gmail.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      d372e204
  2. Jan 04, 2023
  3. Aug 04, 2021
  4. Jul 07, 2021
  5. Jun 29, 2020
  6. Jun 19, 2019
  7. Jun 17, 2019
    • Peter Zijlstra's avatar
      x86/atomic: Fix smp_mb__{before,after}_atomic() · 69d927bb
      Peter Zijlstra authored and Ingo Molnar's avatar Ingo Molnar committed
      
      Recent probing at the Linux Kernel Memory Model uncovered a
      'surprise'. Strongly ordered architectures where the atomic RmW
      primitive implies full memory ordering and
      smp_mb__{before,after}_atomic() are a simple barrier() (such as x86)
      fail for:
      
      	*x = 1;
      	atomic_inc(u);
      	smp_mb__after_atomic();
      	r0 = *y;
      
      Because, while the atomic_inc() implies memory order, it
      (surprisingly) does not provide a compiler barrier. This then allows
      the compiler to re-order like so:
      
      	atomic_inc(u);
      	*x = 1;
      	smp_mb__after_atomic();
      	r0 = *y;
      
      Which the CPU is then allowed to re-order (under TSO rules) like:
      
      	atomic_inc(u);
      	r0 = *y;
      	*x = 1;
      
      And this very much was not intended. Therefore strengthen the atomic
      RmW ops to include a compiler barrier.
      
      NOTE: atomic_{or,and,xor} and the bitops already had the compiler
      barrier.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      69d927bb
  8. Jun 03, 2019
  9. Mar 18, 2019
  10. Aug 25, 2017
  11. Aug 10, 2017
    • Peter Zijlstra's avatar
      Documentation/locking/atomic: Add documents for new atomic_t APIs · 706eeb3e
      Peter Zijlstra authored and Ingo Molnar's avatar Ingo Molnar committed
      
      Since we've vastly expanded the atomic_t interface in recent years the
      existing documentation is woefully out of date and people seem to get
      confused a bit.
      
      Start a new document to hopefully better explain the current state of
      affairs.
      
      The old atomic_ops.txt also covers bitmaps and a few more details so
      this is not a full replacement and we'll therefore keep that document
      around until such a time that we've managed to write more text to cover
      its entire.
      
      Also please, ReST people, go away.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      706eeb3e
Loading