From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753403AbeAaNA7 (ORCPT ); Wed, 31 Jan 2018 08:00:59 -0500 Received: from merlin.infradead.org ([205.233.59.134]:45162 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752852AbeAaNA6 (ORCPT ); Wed, 31 Jan 2018 08:00:58 -0500 Date: Wed, 31 Jan 2018 14:00:34 +0100 From: Peter Zijlstra To: Stafford Horne , Will Deacon , Paul McKenney , Jonas Bonn , Stefan Kristiansson Cc: David Howells , Arnd Bergmann , linux-kernel@vger.kernel.org, Thomas Gleixner Subject: asm-generic: Disallow no-op mb() for SMP systems Message-ID: <20180131130034.GR2269@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) --- 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()