From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: [PATCH v3 03/19] asm/rwonce: Allow __READ_ONCE to be overridden by the architecture Date: Fri, 10 Jul 2020 17:51:47 +0100 Message-ID: <20200710165203.31284-4-will@kernel.org> References: <20200710165203.31284-1-will@kernel.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594399943; bh=JFRVnikzffyM0kLIyVXv4/ggOBXeIFkHnh4eBvBnBLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xzei/k6DhRwA4CoPU2JfT1d96J4vveAm+XAaAkU1cr+BOf+32Tcx/dccl4I4ZPmCx sc4qnD19m1gpde2WR6qzwhjbcO9OZkyoPamVFAOYW5xvGZKM61oOqpDPK2n2MMzllD RXU/MDbaz/SgCunQxxoQ5llZ5g8r2qCnuIoyKmpk= In-Reply-To: <20200710165203.31284-1-will@kernel.org> Sender: linux-alpha-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" To: linux-kernel@vger.kernel.org Cc: Will Deacon , Joel Fernandes , Sami Tolvanen , Nick Desaulniers , Kees Cook , Marco Elver , "Paul E. McKenney" , Matt Turner , Ivan Kokshaysky , Richard Henderson , Peter Zijlstra , Alan Stern , "Michael S. Tsirkin" , Jason Wang , Arnd Bergmann , Boqun Feng , Catalin Marinas , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-alpha@vger.kernel.org, virtualizati The meat and potatoes of READ_ONCE() is defined by the __READ_ONCE() macro, which uses a volatile casts in an attempt to avoid tearing of byte, halfword, word and double-word accesses. Allow this to be overridden by the architecture code in the case that things like memory barriers are also required. Acked-by: Paul E. McKenney Signed-off-by: Will Deacon --- include/asm-generic/rwonce.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/asm-generic/rwonce.h b/include/asm-generic/rwonce.h index 92cc2f223cb3..f9dfa88fc04d 100644 --- a/include/asm-generic/rwonce.h +++ b/include/asm-generic/rwonce.h @@ -33,7 +33,9 @@ * atomicity or dependency ordering guarantees. Note that this may result * in tears! */ +#ifndef __READ_ONCE #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x)) +#endif #define __READ_ONCE_SCALAR(x) \ ({ \ -- 2.27.0.383.g050319c2ae-goog