Skip to content
  • Peter Zijlstra's avatar
    locking/mcs: Fix mcs_spin_lock() ordering · 920c720a
    Peter Zijlstra authored
    Similar to commit b4b29f94
    
     ("locking/osq: Fix ordering of node
    initialisation in osq_lock") the use of xchg_acquire() is
    fundamentally broken with MCS like constructs.
    
    Furthermore, it turns out we rely on the global transitivity of this
    operation because the unlock path observes the pointer with a
    READ_ONCE(), not an smp_load_acquire().
    
    This is non-critical because the MCS code isn't actually used and
    mostly serves as documentation, a stepping stone to the more complex
    things we've build on top of the idea.
    
    Reported-by: default avatarAndrea Parri <parri.andrea@gmail.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Will Deacon <will.deacon@arm.com>
    Fixes: 3552a07a
    
     ("locking/mcs: Use acquire/release semantics")
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    920c720a