mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: benh@kernel.crashing.org, paulmck@linux.vnet.ibm.com,
	Ingo Molnar <mingo@elte.hu>, Boqun Feng <boqun.feng@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	1vier1@web.de, Davidlohr Bueso <dave@stgolabs.net>,
	Manfred Spraul <manfred@colorfullife.com>
Subject: [PATCH 0/5 V5] Clarify/standardize memory barriers for lock/unlock
Date: Wed, 31 Aug 2016 15:42:25 +0200	[thread overview]
Message-ID: <1472650950-3131-1-git-send-email-manfred@colorfullife.com> (raw)

Hi,

V5: Major restructuring based on input from Peter and Davidlohr.

As discussed before:
If a high-scalability locking scheme is built with multiple
spinlocks, then often additional memory barriers are required.

The documentation was not as clear as possible, and memory
barriers were missing / superfluous in the implementation.

Patch 1: sem.c: Remove the smp_rmb() after spin_unlock_wait().
Patch 2: Documentation
Patch 3: Add spinlock_store_acquire(), update ipc/sem.c
Patch 4: Move smp_mb__after_unlock_lock to <linux/spinlock.h>
Patch 5: Fix memory ordering for nf_conntrack

The patches are safe for all architectures, the default is smp_mb().

Patch 5 is larger than required, it rewrites the conntrack logic
with the code from ipc/sem.c. I think the new code is simpler
and more realtime-friendly.

@Peter: A hint if qspinlocks can omit the smp_mb() would be
appreciated (everywhere or x86-only).
The comments on top of queued_spin_unlock_wait() had convinced
me that no additional barrier is required.
But the comment also convinced me that on x86, no further
barrier would be required for a full smp_mb() - and there you
wrote that this is wrong.

@Andrew: The patches are relative to mmots.
Could you include them in your tree, with the target of including in
linux-next?

--
	Manfred

             reply	other threads:[~2016-08-31 13:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 13:42 Manfred Spraul [this message]
2016-08-31 13:42 ` [PATCH 1/5] ipc/sem.c: Remove smp_rmb() from complexmode_enter() Manfred Spraul
2016-08-31 13:42 ` [PATCH 2/5] spinlock: Document memory barrier rules for spin_lock and spin_unlock() Manfred Spraul
2016-08-31 13:42 ` [PATCH 3/5] spinlock: define spinlock_store_acquire Manfred Spraul
2016-08-31 13:42 ` [PATCH 4/5] spinlock.h: Move smp_mb__after_unlock_lock to spinlock.h Manfred Spraul
2016-08-31 13:42 ` [PATCH 5/5] net/netfilter/nf_conntrack_core: update memory barriers Manfred Spraul
2016-08-31 14:15   ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472650950-3131-1-git-send-email-manfred@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=1vier1@web.de \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=boqun.feng@gmail.com \
    --cc=dave@stgolabs.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®