17 Jul, 2018

7 commits

  • norm7 produces the 'normalized' name of a litmus test, when the test
    can be generated from a single cycle that passes through each process
    exactly once. The commit renames such tests in order to comply to the
    naming scheme implemented by this tool.

    Signed-off-by: Andrea Parri
    Signed-off-by: Paul E. McKenney
    Acked-by: Alan Stern
    Cc: Akira Yokosawa
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/20180716180605.16115-14-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     
  • The tools/memory-model/Documentation/explanation.txt file says
    "For each other CPU C', smb_wmb() forces all po-earlier stores"
    This commit therefore replaces the "smb_wmb()" with "smp_wmb()".

    Signed-off-by: Yauheni Kaliuta
    Signed-off-by: Paul E. McKenney
    Acked-by: Alan Stern
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/20180716180605.16115-13-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Yauheni Kaliuta
     
  • This commit makes the scripts executable to avoid the need for everyone
    to do so manually in their archive.

    Signed-off-by: Paul E. McKenney
    Acked-by: Akira Yokosawa
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: stern@rowland.harvard.edu
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/20180716180605.16115-7-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Since commit:

    b899a850431e2dd0 ("compiler.h: Remove ACCESS_ONCE()")

    ... there has been no definition of ACCESS_ONCE() in the kernel tree,
    and it has been necessary to use READ_ONCE() or WRITE_ONCE() instead.

    Correspondingly, let's remove ACCESS_ONCE() from the kernel memory
    model.

    Signed-off-by: Mark Rutland
    Signed-off-by: Paul E. McKenney
    Acked-by: Andrea Parri
    Cc: Akira Yokosawa
    Cc: Alan Stern
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/20180716180605.16115-6-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Mark Rutland
     
  • Since commit:

    b899a850431e2dd0 ("compiler.h: Remove ACCESS_ONCE()")

    ... there has been no definition of ACCESS_ONCE() in the kernel tree,
    and it has been necessary to use READ_ONCE() or WRITE_ONCE() instead.

    Let's update the exmaples in recipes.txt likewise for consistency, using
    READ_ONCE() for reads.

    Signed-off-by: Mark Rutland
    Signed-off-by: Paul E. McKenney
    Acked-by: Andrea Parri
    Cc: Akira Yokosawa
    Cc: Alan Stern
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/20180716180605.16115-5-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Mark Rutland
     
  • The names on the first line of the litmus tests are arbitrary,
    but the convention is that they be the filename without the trailing
    ".litmus". This commit therefore removes the stray trailing ".litmus"
    from ISA2+pooncelock+pooncelock+pombonce.litmus's name.

    Reported-by: Andrea Parri
    Signed-off-by: Paul E. McKenney
    Acked-by: Alan Stern
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/20180716180605.16115-2-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • This commit adds a litmus test suggested by Alan Stern that is forbidden
    on fully multicopy atomic systems, but allowed on other-multicopy and
    on non-multicopy atomic systems. For reference, s390 is fully multicopy
    atomic, x86 and ARMv8 are other-multicopy atomic, and ARMv7 and powerpc
    are non-multicopy atomic.

    Suggested-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Acked-by: Alan Stern
    Acked-by: Andrea Parri
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/20180716180605.16115-1-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

15 May, 2018

18 commits

  • The paper discusses the revised ARMv8 memory model; such revision
    had an important impact on the design of the LKMM.

    Signed-off-by: Andrea Parri
    Signed-off-by: Paul E. McKenney
    Cc: Akira Yokosawa
    Cc: Alan Stern
    Cc: Andrew Morton
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-19-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     
  • ASPLOS 2018 was held in March: make sure this is reflected in
    header comments and references.

    Signed-off-by: Andrea Parri
    Signed-off-by: Paul E. McKenney
    Cc: Akira Yokosawa
    Cc: Alan Stern
    Cc: Andrew Morton
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-18-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     
  • This commit uses tabs for indentation and adds spaces around binary
    operator.

    Signed-off-by: Andrea Parri
    Signed-off-by: Paul E. McKenney
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: stern@rowland.harvard.edu
    Link: http://lkml.kernel.org/r/1526340837-12222-16-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     
  • lock.cat contains old comments and code referring to the possibility
    of LKR events that are not part of an RMW pair. This is a holdover
    from when I though we might end up using LKR events to implement
    spin_is_locked(). Reword the comments to remove this assumption and
    replace domain(lk-rmw) in the code with LKR.

    Tested-by: Andrea Parri
    [ paulmck: Pulled as lock-nest into previous line as discussed. ]
    Signed-off-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Cc: Akira Yokosawa
    Cc: Andrew Morton
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-15-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Alan Stern
     
  • The code in lock.cat which checks for normal read/write accesses to
    spinlock variables doesn't take into account the newly added RL and RU
    events. Add them into the test, and move the resulting code up near
    the start of the file, since a violation would indicate a pretty
    severe conceptual error in a litmus test.

    Tested-by: Andrea Parri
    Signed-off-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Cc: Akira Yokosawa
    Cc: Andrew Morton
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-14-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Alan Stern
     
  • This patch improves the comments in tools/memory-model/lock.cat. In
    addition to making the text more uniform and removing redundant
    comments, it adds a description of all the possible locking events
    that herd can generate.

    Tested-by: Andrea Parri
    Signed-off-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Cc: Akira Yokosawa
    Cc: Andrew Morton
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-13-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Alan Stern
     
  • This patch simplifies the implementation of spin_is_locked in the
    LKMM. It capitalizes on the fact that a failed spin_trylock() and a
    spin_is_locked() which returns True have exactly the same semantics
    (those of READ_ONCE) and ordering properties (none). Therefore the
    two kinds of events can be combined and handled by the same code,
    instead of treated separately as they are currently.

    Tested-by: Andrea Parri
    Signed-off-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Cc: Akira Yokosawa
    Cc: Andrew Morton
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-12-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Alan Stern
     
  • This commit flags WRC+pooncerelease+rmbonceonce+Once.litmus
    as being forbidden by smp_store_release() A-cumulativity and
    IRIW+mbonceonces+OnceOnce.litmus as being forbidden by the LKMM
    propagation rule.

    Suggested-by: Andrea Parri
    Reported-by: Paolo Bonzini
    [ paulmck: Updated wording as suggested by Alan Stern. ]
    Signed-off-by: Paul E. McKenney
    Acked-by: Alan Stern
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-11-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • This commit first adds a trivial macro for spin_is_locked() to
    linux-kernel.def.

    It also adds cat code for enumerating all possible matches of lock
    write events (set LKW) with islocked events returning true (set RL,
    for Read from Lock), and unlock write events (set UL) with islocked
    events returning false (set RU, for Read from Unlock). Note that this
    intentionally does not model uniprocessor kernels (CONFIG_SMP=n) built
    with CONFIG_DEBUG_SPINLOCK=n, in which spin_is_locked() unconditionally
    returns zero.

    It also adds a pair of litmus tests demonstrating the minimal ordering
    provided by spin_is_locked() in conjunction with spin_lock(). Will Deacon
    noted that this minimal ordering happens on ARMv8:
    https://lkml.kernel.org/r/20180226162426.GB17158@arm.com

    Notice that herd7 installations strictly older than version 7.49
    do not handle the new constructs.

    Signed-off-by: Luc Maranget
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Alan Stern
    Cc: Akira Yokosawa
    Cc: Andrea Parri
    Cc: Andrew Morton
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Link: http://lkml.kernel.org/r/1526340837-12222-10-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Luc Maranget
     
  • This commit adds a pair of scripts that run the memory model on litmus
    tests, checking that the verification result of each litmus test matches
    the result flagged in the litmus test itself. These scripts permit easier
    checking of changes to the memory model against preconceived notions.

    To run the scripts, go to the tools/memory-model directory and type
    "scripts/checkalllitmus.sh". If all is well, the last line printed will
    be "All litmus tests verified as was expected."

    Signed-off-by: Paul E. McKenney
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: stern@rowland.harvard.edu
    Link: http://lkml.kernel.org/r/1526340837-12222-9-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • This commit fixes white spaces around semicolons.

    Signed-off-by: Andrea Parri
    Signed-off-by: Paul E. McKenney
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: stern@rowland.harvard.edu
    Link: http://lkml.kernel.org/r/1526340837-12222-8-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     
  • This commit models 'smp_store_mb(x, val);' to be semantically equivalent
    to 'WRITE_ONCE(x, val); smp_mb();'.

    Suggested-by: Paolo Bonzini
    Suggested-by: Peter Zijlstra
    Signed-off-by: Andrea Parri
    Signed-off-by: Paul E. McKenney
    Acked-by: Alan Stern
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-7-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     
  • …rders later RMW operations

    The current cheat sheet does not claim that smp_mb__after_atomic()
    orders later RMW atomic operations, which it must, at least against
    earlier RMW atomic operations and whatever precedes them.

    This commit therefore adds the needed "Y".

    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-6-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Paul E. McKenney
     
  • 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
    Signed-off-by: Paul E. McKenney
    Acked-by: Alan Stern
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-5-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • "RWM" should be "RMW".

    Signed-off-by: Paolo Bonzini
    Signed-off-by: Paul E. McKenney
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: stern@rowland.harvard.edu
    Link: http://lkml.kernel.org/r/1526340837-12222-4-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paolo Bonzini
     
  • Code generated by klitmus7 version 7.48 doesn't compile with kernel
    header of 4.15 and later due to the absence of ACCESS_ONCE().
    As the issue has been resolved in herdtools7 7.49, bump the required
    version number in README.

    Signed-off-by: Akira Yokosawa
    Signed-off-by: Paul E. McKenney
    Cc: Alan Stern
    Cc: Andrea Parri
    Cc: Andrew Morton
    Cc: Boqun Feng
    Cc: David Howells
    Cc: Jade Alglave
    Cc: Linus Torvalds
    Cc: Luc Maranget
    Cc: Nicholas Piggin
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arch@vger.kernel.org
    Link: http://lkml.kernel.org/r/1526340837-12222-3-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Akira Yokosawa
     
  • This patch reorganizes the definition of rb in the Linux Kernel Memory
    Consistency Model. The relation is now expressed in terms of
    rcu-fence, which consists of a sequence of gp and rscs links separated
    by rcu-link links, in which the number of occurrences of gp is >= the
    number of occurrences of rscs.

    Arguments similar to those published in
    http://diy.inria.fr/linux/long.pdf show that rcu-fence behaves like an
    inter-CPU strong fence. Furthermore, the definition of rb in terms of
    rcu-fence is highly analogous to the definition of pb in terms of
    strong-fence, which can help explain why rcu-path expresses a form of
    temporal ordering.

    This change should not affect the semantics of the memory model, just
    its internal organization.

    Signed-off-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Boqun Feng
    Reviewed-by: Andrea Parri
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: akiyks@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-2-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Alan Stern
     
  • This patch makes a simple non-functional change to the RCU portion of
    the Linux Kernel Memory Consistency Model by renaming the "link" and
    "rcu-path" relations to "rcu-link" and "rb", respectively.

    The name "link" was an unfortunate choice, because it was too generic
    and subject to confusion with other meanings of the same word, which
    occur quite often in LKMM documentation. The name "rcu-path" is not
    very appropriate, because the relation is analogous to the
    happens-before (hb) and propagates-before (pb) relations -- although
    that fact won't become apparent until the second patch in this series.

    Signed-off-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Acked-by: Andrea Parri
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Link: http://lkml.kernel.org/r/1526340837-12222-1-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Alan Stern
     

10 Mar, 2018

3 commits

  • …d lockless_dereference()

    Commit:

    bf28ae562744 ("tools/memory-model: Remove rb-dep, smp_read_barrier_depends, and lockless_dereference")

    was merged too early, while it was still in RFC form. This patch adds in
    the missing pieces.

    Akira pointed out some typos in the original patch, and he noted that
    cheatsheet.txt should indicate that READ_ONCE() now implies an address
    dependency. Andrea suggested documenting the relationship betwwen
    unsuccessful RMW operations and address dependencies.

    Andrea pointed out that the macro for rcu_dereference() in linux.def
    should now use the "once" annotation instead of "deref". He also
    suggested that the comments should mention commit:

    5a8897cc7631 ("locking/atomics/alpha: Add smp_read_barrier_depends() to _release()/_relaxed() atomics")

    ... as an important precursor, and he contributed commit:

    cb13b424e986 ("locking/xchg/alpha: Add unconditional memory barrier to cmpxchg()")

    which is another prerequisite.

    Suggested-by: Akira Yokosawa <akiyks@gmail.com>
    Suggested-by: Andrea Parri <parri.andrea@gmail.com>
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    [ Fixed read_read_lock() typo reported by Akira. ]
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Acked-by: Andrea Parri <parri.andrea@gmail.com>
    Acked-by: Akira Yokosawa <akiyks@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: will.deacon@arm.com
    Fixes: bf28ae562744 ("tools/memory-model: Remove rb-dep, smp_read_barrier_depends, and lockless_dereference")
    Link: http://lkml.kernel.org/r/1520443660-16858-4-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Alan Stern
     
  • The litmus-tests/README file lacks any mention of the new litmus test
    ISA2+pooncelock+pooncelock+pombonce.litmus. This commit therefore
    adds a description of this test.

    Reported-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1520443660-16858-3-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Because the docker and gentoo images haven't been updated in quite some
    time, they are likely to provide more confusion than help. This commit
    therefore removes mention of them from the README file.

    Reported-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1520443660-16858-2-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

21 Feb, 2018

8 commits

  • Since commit 76ebbe78f739 ("locking/barriers: Add implicit
    smp_read_barrier_depends() to READ_ONCE()") was merged for the 4.15
    kernel, it has not been necessary to use smp_read_barrier_depends().
    Similarly, commit 59ecbbe7b31c ("locking/barriers: Kill
    lockless_dereference()") removed lockless_dereference() from the
    kernel.

    Since these primitives are no longer part of the kernel, they do not
    belong in the Linux Kernel Memory Consistency Model. This patch
    removes them, along with the internal rb-dep relation, and updates the
    revelant documentation.

    Signed-off-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Acked-by: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: nborisov@suse.com
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1519169112-20593-12-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Alan Stern
     
  • Typical cat-language code uses hyphens for word separators in
    identifiers, but several LKMM identifiers use underscores instead.
    This commit therefore converts underscores to hyphens in the .bell-
    and .cat-file identifiers corresponding to smp_mb__before_atomic(),
    smp_mb__after_atomic(), and smp_mb__after_spinlock().

    Signed-off-by: Paul E. McKenney
    Acked-by: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: nborisov@suse.com
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: stern@rowland.harvard.edu
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1519169112-20593-11-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • This commit adds a litmus test in which P0() and P1() form a lock-based S
    litmus test, with the addition of P2(), which observes P0()'s and P1()'s
    accesses with a full memory barrier but without the lock. This litmus
    test asks whether writes carried out by two different processes under the
    same lock will be seen in order by a third process not holding that lock.
    The answer to this question is "yes" for all architectures supporting
    the Linux kernel, but is "no" according to the current version of LKMM.

    A patch to LKMM is under development.

    Signed-off-by: Alan Stern
    Signed-off-by: Paul E. McKenney
    Acked-by: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: nborisov@suse.com
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1519169112-20593-10-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Alan Stern
     
  • LKMM and the herd7 tool are co-evolving, and out-of-date herd7 tools
    produce inaccurate results, often with no obvious error messages. This
    commit therefore adds the required herd7 version to the LKMM README file.

    Longer term, it would be good if .cat files could specify the required
    version in a manner allowing herd7 to produce clear diagnostics.

    Suggested-by: Akira Yokosawa
    Signed-off-by: Paul E. McKenney
    Acked-by: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: nborisov@suse.com
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: stern@rowland.harvard.edu
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1519169112-20593-9-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Signed-off-by: Paul E. McKenney
    Acked-by: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: nborisov@suse.com
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: stern@rowland.harvard.edu
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1519169112-20593-5-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • This commit adds comments to the litmus tests summarizing what these
    tests are intended to demonstrate.

    [ paulmck: Apply Andrea's and Alan's feedback. ]
    Suggested-by: Ingo Molnar
    Signed-off-by: Paul E. McKenney
    Acked-by: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: nborisov@suse.com
    Cc: npiggin@gmail.com
    Cc: parri.andrea@gmail.com
    Cc: stern@rowland.harvard.edu
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1519169112-20593-4-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     
  • Move the contents of tools/memory-model/MAINTAINERS into the main
    MAINTAINERS file, removing tools/memory-model/MAINTAINERS. This
    allows get_maintainer.pl to correctly identify the maintainers of
    tools/memory-model/.

    Suggested-by: Ingo Molnar
    Signed-off-by: Andrea Parri
    Signed-off-by: Paul E. McKenney
    Acked-by: Peter Zijlstra
    Acked-by: Will Deacon
    Acked-by: Alan Stern
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: nborisov@suse.com
    Cc: npiggin@gmail.com
    Link: http://lkml.kernel.org/r/1519169112-20593-2-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     
  • Ingo pointed out that:

    "The "memory model" name is overly generic, ambiguous and somewhat
    misleading, as we usually mean the virtual memory layout/model
    when we say "memory model". GCC too uses it in that sense [...]"

    Make it clear that tools/memory-model/ uses the term "memory model" as
    shorthand for "memory consistency model" by calling out this convention
    in tools/memory-model/README.

    Stick to the original "memory model" term in sources' headers and for
    the subsystem name.

    Suggested-by: Ingo Molnar
    Signed-off-by: Andrea Parri
    Signed-off-by: Paul E. McKenney
    Acked-by: Peter Zijlstra
    Acked-by: Will Deacon
    Acked-by: Alan Stern
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Cc: akiyks@gmail.com
    Cc: boqun.feng@gmail.com
    Cc: dhowells@redhat.com
    Cc: j.alglave@ucl.ac.uk
    Cc: linux-arch@vger.kernel.org
    Cc: luc.maranget@inria.fr
    Cc: nborisov@suse.com
    Cc: npiggin@gmail.com
    Link: http://lkml.kernel.org/r/1519169112-20593-1-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    Andrea Parri
     

25 Jan, 2018

1 commit

  • There is some reason to believe that Documentation/memory-barriers.txt
    could use some help, and a major purpose of this patch is to provide
    that help in the form of a design-time tool that can produce all valid
    executions of a small fragment of concurrent Linux-kernel code, which is
    called a "litmus test". This tool's functionality is roughly similar to
    a full state-space search. Please note that this is a design-time tool,
    not useful for regression testing. However, we hope that the underlying
    Linux-kernel memory model will be incorporated into other tools capable
    of analyzing large bodies of code for regression-testing purposes.

    The main tool is herd7, together with the linux-kernel.bell,
    linux-kernel.cat, linux-kernel.cfg, linux-kernel.def, and lock.cat files
    added by this patch. The herd7 executable takes the other files as input,
    and all of these files collectively define the Linux-kernel memory memory
    model. A brief description of each of these other files is provided
    in the README file. Although this tool does have its limitations,
    which are documented in the README file, it does improve on the version
    reported on in the LWN series (https://lwn.net/Articles/718628/ and
    https://lwn.net/Articles/720550/) by supporting locking and arithmetic,
    including a much wider variety of read-modify-write atomic operations.
    Please note that herd7 is not part of this submission, but is freely
    available from http://diy.inria.fr/sources/index.html (and via "git"
    at https://github.com/herd/herdtools7).

    A second tool is klitmus7, which converts litmus tests to loadable
    kernel modules for direct testing. As with herd7, the klitmus7
    code is freely available from http://diy.inria.fr/sources/index.html
    (and via "git" at https://github.com/herd/herdtools7).

    Of course, litmus tests are not always the best way to fully understand a
    memory model, so this patch also includes Documentation/explanation.txt,
    which describes the memory model in detail. In addition,
    Documentation/recipes.txt provides example known-good and known-bad use
    cases for those who prefer working by example.

    This patch also includes a few sample litmus tests, and a great many
    more litmus tests are available at https://github.com/paulmckrcu/litmus.

    This patch was the result of a most excellent collaboration founded
    by Jade Alglave and also including Alan Stern, Andrea Parri, and Luc
    Maranget. For more details on the history of this collaboration, please
    refer to the Linux-kernel memory model presentations at 2016 LinuxCon EU,
    2016 Kernel Summit, 2016 Linux Plumbers Conference, 2017 linux.conf.au,
    or 2017 Linux Plumbers Conference microconference. However, one aspect
    of the history does bear repeating due to weak copyright tracking earlier
    in this project, which extends back to early 2015. This weakness came
    to light in late 2017 after an LKMM presentation by Paul in which an
    audience member noted the similarity of some LKMM code to code in early
    published papers. This prompted a copyright review.

    From Alan Stern:

    To say that the model was mine is not entirely accurate.
    Pieces of it (especially the Scpv and Atomic axioms) were taken
    directly from Jade's models. And of course the Happens-before
    and Propagation relations and axioms were heavily based on
    Jade and Luc's work, even though they weren't identical to the
    earlier versions. Only the RCU portion was completely original.

    . . .

    One can make a much better case that I wrote the bulk of lock.cat.
    However, it was inspired by Luc's earlier version (and still
    shares some elements in common), and of course it benefited from
    feedback and testing from all members of our group.

    The model prior to Alan's was Luc Maranget's. From Luc:

    I totally agree on Alan Stern's account of the linux kernel model
    genesis. I thank him for his acknowledgments of my participation
    to previous model drafts. I'd like to complete Alan Stern's
    statement: any bell cat code I have written has its roots in
    discussions with Jade Alglave and Paul McKenney. Moreover I
    have borrowed cat and bell code written by Jade Alglave freely.

    This copyright review therefore resulted in late adds to the copyright
    statements of several files.

    Discussion of v1 has raised several issues, which we do not believe should
    block acceptance given that this level of change will be ongoing, just
    as it has been with memory-barriers.txt:

    o Under what conditions should ordering provided by pure locking
    be seen by CPUs not holding the relevant lock(s)? In particular,
    should the message-passing pattern be forbidden?

    o Should examples involving C11 release sequences be forbidden?
    Note that this C11 is still a moving target for this issue:
    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0735r0.html

    o Some details of the handling of internal dependencies for atomic
    read-modify-write atomic operations are still subject to debate.

    o Changes recently accepted into mainline greatly reduce the need
    to handle DEC Alpha as a special case. These changes add an
    smp_read_barrier_depends() to READ_ONCE(), thus causing Alpha
    to respect ordering of dependent reads. If these changes stick,
    the memory model can be simplified accordingly.

    o Will changes be required to accommodate RISC-V?

    Differences from v1:
    (http://lkml.kernel.org/r/20171113184031.GA26302@linux.vnet.ibm.com)

    o Add SPDX notations to .bell and .cat files, replacing
    textual license statements.

    o Add reference to upcoming ASPLOS paper to .bell and .cat files.

    o Updated identifier names in .bell and .cat files to match those
    used in the ASPLOS paper.

    o Updates to READMEs and other documentation based on review
    feedback.

    o Added a memory-ordering cheatsheet.

    o Update sigs to new Co-Developed-by and add acks and
    reviewed-bys.

    o Simplify rules detecting nested RCU read-side critical sections.

    o Update copyright statements as noted above.

    Co-Developed-by: Alan Stern
    Co-Developed-by: Andrea Parri
    Co-Developed-by: Jade Alglave
    Co-Developed-by: Luc Maranget
    Co-Developed-by: "Paul E. McKenney"
    Signed-off-by: Alan Stern
    Signed-off-by: Andrea Parri
    Signed-off-by: Jade Alglave
    Signed-off-by: Luc Maranget
    Signed-off-by: "Paul E. McKenney"
    Reviewed-by: Boqun Feng
    Acked-by: Will Deacon
    Acked-by: Peter Zijlstra
    Acked-by: Nicholas Piggin
    Acked-by: David Howells
    Acked-by: "Reshetova, Elena"
    Acked-by: Michal Hocko
    Acked-by: Akira Yokosawa
    Cc:

    Paul E. McKenney