Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1474292

Re: [PATCH 1/4] spinlock: Document memory barrier rules

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/4] spinlock: Document memory barrier rules
Date 2016-09-01 13:20 +0200
Message-ID <scych-16c-19@gated-at.bofh.it> (permalink)
References (5 earlier) <scfW1-4eb-7@gated-at.bofh.it> <scgS6-4O7-23@gated-at.bofh.it> <sciAx-5Wj-17@gated-at.bofh.it> <scvR8-7fO-7@gated-at.bofh.it> <scy2C-11X-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Sep 01, 2016 at 01:04:26PM +0200, Manfred Spraul wrote:
> If I understand it right, the rules are:
> 1. spin_unlock_wait() must behave like spin_lock();spin_unlock();
> 2. spin_is_locked() must behave like spin_trylock() ? spin_unlock(),TRUE :
> FALSE

I don't think spin_is_locked is as strong as all that. On arm64 and ppc,
it's just smp_mb(); followed by a check on the lock value. It can't be
used for the same sorts of inter-CPU synchronisation that spin_unlock_wait
provides.

> 3. the ACQUIRE during spin_lock applies to the lock load, not to the store.

Correct. This is already documented for things like cmpxchg.

> sem.c and nf_conntrack.c need only rule 1 now, but I would document the rest
> as well, ok?
> 
> I'll update the patches.

Please CC me!

Will

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] Clarify/standardize memory barriers for lock/unlock Manfred Spraul <manfred@colorfullife.com> - 2016-08-28 14:00 +0200
  [PATCH 1/4] spinlock: Document memory barrier rules Manfred Spraul <manfred@colorfullife.com> - 2016-08-28 14:00 +0200
    [PATCH 2/4] barrier.h: Move smp_mb__after_unlock_lock to barrier.h Manfred Spraul <manfred@colorfullife.com> - 2016-08-28 14:00 +0200
      Re: [PATCH 2/4] barrier.h: Move smp_mb__after_unlock_lock to  barrier.h "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-28 15:50 +0200
        [PATCH 2/4] barrier.h: Move smp_mb__after_unlock_lock to barrier.h Manfred Spraul <manfred@colorfullife.com> - 2016-08-28 18:40 +0200
        Re: [PATCH 2/4] barrier.h: Move smp_mb__after_unlock_lock to  barrier.h Manfred Spraul <manfred@colorfullife.com> - 2016-08-28 20:10 +0200
    Re: [PATCH 1/4] spinlock: Document memory barrier rules Peter Zijlstra <peterz@infradead.org> - 2016-08-29 12:50 +0200
      Re: [PATCH 1/4] spinlock: Document memory barrier rules Manfred Spraul <manfred@colorfullife.com> - 2016-08-29 15:00 +0200
        Re: [PATCH 1/4] spinlock: Document memory barrier rules Peter Zijlstra <peterz@infradead.org> - 2016-08-29 15:50 +0200
          Re: [PATCH 1/4] spinlock: Document memory barrier rules Manfred Spraul <manfred@colorfullife.com> - 2016-08-31 07:00 +0200
            Re: [PATCH 1/4] spinlock: Document memory barrier rules Peter Zijlstra <peterz@infradead.org> - 2016-08-31 17:50 +0200
              Re: [PATCH 1/4] spinlock: Document memory barrier rules Will Deacon <will.deacon@arm.com> - 2016-08-31 18:50 +0200
                Re: [PATCH 1/4] spinlock: Document memory barrier rules Manfred Spraul <manfred@colorfullife.com> - 2016-08-31 20:40 +0200
                Re: [PATCH 1/4] spinlock: Document memory barrier rules Peter Zijlstra <peterz@infradead.org> - 2016-09-01 10:50 +0200
                Re: [PATCH 1/4] spinlock: Document memory barrier rules Manfred Spraul <manfred@colorfullife.com> - 2016-09-01 13:10 +0200
                Re: [PATCH 1/4] spinlock: Document memory barrier rules Will Deacon <will.deacon@arm.com> - 2016-09-01 13:20 +0200
                Re: [PATCH 1/4] spinlock: Document memory barrier rules Peter Zijlstra <peterz@infradead.org> - 2016-09-01 14:00 +0200
                Re: [PATCH 1/4] spinlock: Document memory barrier rules Boqun Feng <boqun.feng@gmail.com> - 2016-09-01 16:10 +0200
  Re: [PATCH 0/4] Clarify/standardize memory barriers for lock/unlock Peter Zijlstra <peterz@infradead.org> - 2016-08-29 13:00 +0200

csiph-web