Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp778873ybj; Tue, 5 May 2020 07:26:18 -0700 (PDT) X-Google-Smtp-Source: APiQypJQLFJsKl0xJbAkTtXVZwkC+B8qHefzWuNg3kWklDpo2aE8r3S007sd4gFbIWIMpfkAdBnh X-Received: by 2002:a05:6402:379:: with SMTP id s25mr2977801edw.69.1588688778203; Tue, 05 May 2020 07:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588688778; cv=none; d=google.com; s=arc-20160816; b=zhbIDdxoo/n7sycy+hdiyiFdtOWSh2H4k6sWXlJrcSd4IRDm2dkOtN4CguruAEAbmA l+TX7Ff5TzO5jo6LUwxzqRhQnPMOw6SGQo6Bo15lpQEuvIOWyNC85ghPUKEOECyRMy65 Oe5ehFw5G18kI7MiK2RXpoJFBSbyspJcD+CyRI32Z2A+FAW66O/H8nkkMTNQ1vjNGI3P iIc5rk6C9va6vOoh64tDlbgcEfWfwLDaVx62GuyWg23fNnwcTE81A1q3hFe6i/WcME9G UglcFAPJPiwl0n3IrF2IZJFJbNQFgmTLRc/40hzP3ICjTyUIY6CMTfQ3BV1dEs3PCyzZ LSvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:subject:cc:to:from:date:user-agent:message-id; bh=tIzjtNhGs+F8UwHwFcUg95w2GHC5TFZ7dCI5YgTbLzk=; b=wGzVU9bc6QiOFiqwntl8wrkSvYjEsP9KRsr2LUwysYDe9HeYV6TabB1z7km7HqwXW+ nji0PHyrIs7b9hmK49mMI+ESAvk15Vd/d8UMjtMh9QJBdqmsrdR563ubhyG33XCh0T3N VCuloaQ7BHuiqzlD08LPHyvH7GycU1ZRz0Fr3VjEe4rLohZr3ArmPIkOCGXl+UotUN0n bQf9zXtq/VuMRgu4dBtkeXPSOjQ7EiOhsuJX1yzcZJZF6DSF4ZwrsllKGb9vRexbbW5z qBAfwayAl9lV67jhGvWv/ua3r4FDk3oMUhS5NiPqBfhz62hXhQYwKBmwA3Eyxz2AdYRT BF2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si1328078edt.286.2020.05.05.07.25.55; Tue, 05 May 2020 07:26:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729458AbgEEON4 (ORCPT + 99 others); Tue, 5 May 2020 10:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729421AbgEEONv (ORCPT ); Tue, 5 May 2020 10:13:51 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2400EC061A0F for ; Tue, 5 May 2020 07:13:51 -0700 (PDT) Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jVyK1-0000MB-UN; Tue, 05 May 2020 16:13:22 +0200 Received: from nanos.tec.linutronix.de (localhost [IPv6:::1]) by nanos.tec.linutronix.de (Postfix) with ESMTP id 2D109FFC8D; Tue, 5 May 2020 16:13:21 +0200 (CEST) Message-Id: <20200505134058.651504242@linutronix.de> User-Agent: quilt/0.65 Date: Tue, 05 May 2020 15:16:08 +0200 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, "Paul E. McKenney" , Andy Lutomirski , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Steven Rostedt , Joel Fernandes , Boris Ostrovsky , Juergen Gross , Brian Gerst , Mathieu Desnoyers , Josh Poimboeuf , Will Deacon , "Peter Zijlstra (Intel)" Subject: [patch V4 part 1 06/36] compiler: Simple READ/WRITE_ONCE() implementations References: <20200505131602.633487962@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-transfer-encoding: 8-bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org READ/WRITE_ONCE_NOCHECK() is required for atomics in code which cannot be instrumented like the x86 int3 text poke code. As READ/WRITE_ONCE() is undergoing a rewrite, provide __{READ,WRITE}_ONCE_SCALAR(). Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner --- include/linux/compiler.h | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -313,6 +313,14 @@ unsigned long read_word_at_a_time(const __u.__val; \ }) +#define __READ_ONCE_SCALAR(x) \ + (*(const volatile typeof(x) *)&(x)) + +#define __WRITE_ONCE_SCALAR(x, val) \ +do { \ + *(volatile typeof(x) *)&(x) = val; \ +} while (0) + /** * data_race - mark an expression as containing intentional data races *