mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: mingo@kernel.org
Cc: linux-kernel@vger.kernel.org, Will Deacon <will.deacon@arm.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH v2 2/5] locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
Date: Tue, 24 Oct 2017 11:22:47 +0100	[thread overview]
Message-ID: <1508840570-22169-3-git-send-email-will.deacon@arm.com> (raw)
In-Reply-To: <1508840570-22169-1-git-send-email-will.deacon@arm.com>

In preparation for the removal of lockless_dereference(), which is the
same as READ_ONCE() on all architectures other than Alpha, add an
implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
used to head dependency chains on all architectures.

Cc: Ingo Molnar <mingo@kernel.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 include/linux/compiler.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 08083186e54f..7d7b77da9716 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -242,6 +242,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
 		__read_once_size(&(x), __u.__c, sizeof(x));		\
 	else								\
 		__read_once_size_nocheck(&(x), __u.__c, sizeof(x));	\
+	smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
 	__u.__val;							\
 })
 #define READ_ONCE(x) __READ_ONCE(x, 1)
-- 
2.1.4

  parent reply	other threads:[~2017-10-24 10:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 10:22 [PATCH v2 0/5] Get rid of lockless_dereference() Will Deacon
2017-10-24 10:22 ` [PATCH v2 1/5] linux/compiler.h: Split into compiler.h and compiler_types.h Will Deacon
2017-10-24 12:46   ` [tip:locking/core] " tip-bot for Will Deacon
2017-10-24 10:22 ` Will Deacon [this message]
2017-10-24 12:46   ` [tip:locking/core] locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE() tip-bot for Will Deacon
2017-10-24 10:22 ` [PATCH v2 3/5] locking/barriers: Convert users of lockless_dereference() " Will Deacon
2017-10-24 12:47   ` [tip:locking/core] " tip-bot for Will Deacon
2017-10-24 10:22 ` [PATCH v2 4/5] locking/barriers: Kill lockless_dereference() Will Deacon
2017-10-24 12:47   ` [tip:locking/core] " tip-bot for Will Deacon
2017-10-24 10:22 ` [PATCH v2 5/5] alpha: atomics: Add smp_read_barrier_depends() to release/relaxed atomics Will Deacon
2017-10-24 12:47   ` [tip:locking/core] locking/atomics/alpha: Add smp_read_barrier_depends() to _release()/_relaxed() atomics tip-bot for Will Deacon

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=1508840570-22169-3-git-send-email-will.deacon@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    /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

Powered by JetHome