Received: by 10.223.176.5 with SMTP id f5csp1384712wra; Wed, 31 Jan 2018 05:45:48 -0800 (PST) X-Google-Smtp-Source: AH8x225mUeJSoI4o7OsbWZYrYesO+nYFbH4UcETH3deh3dOs0ROQdbU59yY4WnJhvxxlnTviHFf+ X-Received: by 10.98.214.7 with SMTP id r7mr34055612pfg.213.1517406348628; Wed, 31 Jan 2018 05:45:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517406348; cv=none; d=google.com; s=arc-20160816; b=hJ6Ejd5UXMZvv96YIGXpW7fL6FvGhnYlUiSpUrim7jz0K70LsWRU9peyC0CSpZAVHr rqJUpQ2dpM1dgxjxYSpYfm0PQXE30aPq8TnRdF41x/VPSdh79zlyUvxh8EI6LJYQ3lDG hVpf8/m/7Ya++xEQ+WxhKurCs+D6ZBDiEYJY6RiEuvSOVWv1DNCpGppBQ/biQDlOeEzT yRp07JbL61uJn4yiiS/o6kNDObfFBR+dMtVvZQhIvree2XznO83k/sKUPLnO+biFcNIp S8Y6YhiJ6fDiii41hc2B5nOOYk7+yL326UEUkr5Gox2DuONvVvODJIXXG41MClOW3HZK bAGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=zIMaDEH7qOTR51BL6xjVWAFOt1PbmueXBxDh/pYdbHs=; b=vs/M/T+urjjupidpXyxPkd7hacP3Uq8pmwdyINC+A4x077sX8HZwAfngBgUhSPGI3O uqEraMJ1e6LUDy/fxziofsLEMQFJoOhMw30RpkQNjcJ1LW2hXJRNME9EMAR0FbhtlzaY +47TGgIUoJWQDdzz/vkxzQC5Yqt9wMMsXO30IHcWwddF68CmJX8K+liQvXutSsXAXVZs jPjR4Q/Wzdhen3A+8DphJOjJCVoAoq5DT+8OVhqFDZnOLUpTo8XGgA+lQyUHyyRlBHtv UNC5wQCPa6O1liJCdBi58tjQxbv/MGQrgVumpL8PhDh7oQIhVlM3qRyMbJP4VMJ+ixUi eXyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=hyRMLW3u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15-v6si4881008pll.160.2018.01.31.05.45.34; Wed, 31 Jan 2018 05:45:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=hyRMLW3u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753396AbeAaNA7 (ORCPT + 99 others); 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 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=zIMaDEH7qOTR51BL6xjVWAFOt1PbmueXBxDh/pYdbHs=; b=hyRMLW3ukJepf5a/vHrIumYCdV yj62FSPbzNZsyBb3FotJPYU65ftC4fSm3TPF9qDsTSGR9HqXvkqV1jsram176aMyi7YMg4xAKMtI1 F2G4oX1Jn0fS+2PKn0JQz/ViMjvER1URuj+Zix8v4gT9pKkgjFG0zOV/exJSR1mRj4qhRAjJ5G+Xy 0vps3TugkiNGIJWeRmQhoGUtV+dZ+kIkHfMM5jQ+VrkeopeTOo/+4k7KZ9q2R9SW5ZIsVM9ZaCHSd taiELvOanYvaCmXg5F8YvPB6hbJgSF5NA0zZuTptmBtrQbsApXAbOJh9AoL0vbxpBNunogF4YKIU8 TIqVdXEQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1egs0B-0006aX-Rm; Wed, 31 Jan 2018 13:00:36 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 97D352029F9F9; Wed, 31 Jan 2018 14:00:34 +0100 (CET) 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 Precedence: bulk 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()