mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Stafford Horne <shorne@gmail.com>,
	Will Deacon <will.deacon@arm.com>,
	Paul McKenney <paulmck@linux.vnet.ibm.com>,
	Jonas Bonn <jonas@southpole.se>,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: David Howells <dhowells@redhat.com>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: asm-generic: Disallow no-op mb() for SMP systems
Date: Wed, 31 Jan 2018 14:00:34 +0100	[thread overview]
Message-ID: <20180131130034.GR2269@hirez.programming.kicks-ass.net> (raw)


While looking through the qspinlock users, I stumbled upon openrisc and
being curious, I wanted to have a look at its memory model.

To my surprise it doesn't have asm/barrier.h. It does however support
SMP. This lead me to wonder why it would compile, turns out we provide a
no-op mb() if the architecture does not provide one.

With the obvious exception of Sequentially Consistent SMP systems, this
is terribly broken. And seeing how SC SMP is really rather unusual (and
unlikely), change the asm-generic/barrier.h to not provide this.

This _will_ break openrisc builds, they had better clarify their
position by writing their own barrier.h with a comment in.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 include/asm-generic/barrier.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
index fe297b599b0a..7a10748615ff 100644
--- a/include/asm-generic/barrier.h
+++ b/include/asm-generic/barrier.h
@@ -30,9 +30,15 @@
  * Fall back to compiler barriers if nothing better is provided.
  */
 
+#ifndef CONFIG_SMP
+/*
+ * If your SMP architecture really is Sequentially Consistent, you get
+ * barrier.h to write a nice big comment about it.
+ */
 #ifndef mb
 #define mb()	barrier()
 #endif
+#endif
 
 #ifndef rmb
 #define rmb()	mb()

             reply	other threads:[~2018-01-31 13:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 13:00 Peter Zijlstra [this message]
2018-01-31 13:17 ` Will Deacon
2018-01-31 13:26   ` Peter Zijlstra
2018-02-01 12:27     ` Stafford Horne
2018-02-01 13:29       ` Peter Zijlstra
2018-02-01 13:32         ` Will Deacon
2018-02-01 13:53           ` Peter Zijlstra
2018-02-01 15:39             ` Will Deacon
2018-02-01 15:50               ` Peter Zijlstra
2018-02-01 15:52                 ` Peter Zijlstra
2018-02-02 13:48         ` Stafford Horne
2018-02-02 19:14 ` kbuild test robot
2018-02-03 11:43   ` Peter Zijlstra
2018-02-02 20:00 ` kbuild test robot
2018-02-02 20:25   ` Peter Zijlstra
2018-02-02 21:08     ` Alan Cox
2018-02-03 11:42       ` Peter Zijlstra

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=20180131130034.GR2269@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=arnd@arndb.de \
    --cc=dhowells@redhat.com \
    --cc=jonas@southpole.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=shorne@gmail.com \
    --cc=stefan.kristiansson@saunalahti.fi \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.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