From patchwork Tue Oct 24 10:22:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 116931 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5632209qgn; Tue, 24 Oct 2017 03:22:57 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TvJzdlLIyDLohuEZzSapSyzXLGwRpTUwgjWJoO8Zr2FPN5ACtnsYYlebL1DO6025rnVU0I X-Received: by 10.99.121.130 with SMTP id u124mr14570479pgc.124.1508840577766; Tue, 24 Oct 2017 03:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508840577; cv=none; d=google.com; s=arc-20160816; b=x70Wb/9x/30UPGfYpTc6wSEpYNZzHYWFEuERsVCRKf5nHMpHj1RNyQUYBm91/ATdik 4cuDVRi4VsztBOwqxP/Rsqx0c8FSnSzckGnVqIXjRefxFb32QILhIaR8Gdu7I0tsxpS7 NQhRytK1eSlcxc7q3d6hO6N2hSKvoD1jhs7ILJGQrGeRTikCsoWtIgASWzrR44MY/dwG Ek+fO5iGL1i38JdJB93YzH9wXQfhDeAIHjJJXtsFdXKfkLsHdyW1M0MD9tyh7NdkRhh3 jBpPp71kL7thtnGmV/m963MHIiozawS/tGTCi743co3cdChyihIAJ8Q4HcH7w7BOTcYF eRQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=4O0ufGspD1zu+k5kUom2q95aULopZVGxSxkvR5ljU1c=; b=rxrGKf1aR52bqaQie/jZBWNhigIiN6BAcz/kmuEz3EM4AZR2jtltFx59CNziHB8ckD NC1mKpCVBMPH9dlvGzJw4IJFC69c+mNZZ9NQgzT+Y190LsVkoZ7SD21PBd2uwxc086OX 8qB5QY8ElEYini1S0KwIPwa7LB9wyKqiP2Oso0NMdu5MjK0UxfKQLPHkrnbgur71qECo auL+gMZEYAW2Fe+/SBzP6Aijiiu52vsSHcnuzG2bW3X7/t55BbEwR/o/A79S34d23hni Nvx/fb3J2PiReEeT6kdAvEhLfvDWHvGoe+OR87QmacszLnQP+1vKaefmOcjnlKL+fsr2 0uDg== ARC-Authentication-Results: i=1; mx.google.com; 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 a3si5241026pla.160.2017.10.24.03.22.57; Tue, 24 Oct 2017 03:22:57 -0700 (PDT) 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; 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 S932595AbdJXKW4 (ORCPT + 27 others); Tue, 24 Oct 2017 06:22:56 -0400 Received: from foss.arm.com ([217.140.101.70]:53018 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932498AbdJXKWu (ORCPT ); Tue, 24 Oct 2017 06:22:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A617B1596; Tue, 24 Oct 2017 03:22:50 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7845B3F6CA; Tue, 24 Oct 2017 03:22:50 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id F3C241AE33D8; Tue, 24 Oct 2017 11:22:50 +0100 (BST) From: Will Deacon To: mingo@kernel.org Cc: linux-kernel@vger.kernel.org, Will Deacon , "Paul E. McKenney" 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 Message-Id: <1508840570-22169-3-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1508840570-22169-1-git-send-email-will.deacon@arm.com> References: <1508840570-22169-1-git-send-email-will.deacon@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: "Paul E. McKenney" Signed-off-by: Will Deacon --- include/linux/compiler.h | 1 + 1 file changed, 1 insertion(+) -- 2.1.4 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)