Message ID | 20200710165203.31284-19-will@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=kRck=AV=lists.infradead.org=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F4C113B6 for <patchwork-linux-arm@patchwork.kernel.org>; Fri, 10 Jul 2020 17:16:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA45020674 for <patchwork-linux-arm@patchwork.kernel.org>; Fri, 10 Jul 2020 17:16:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="USKUZpaQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="r/BHNwav"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="TiqVi3ir" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA45020674 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s+7QAgDSX7clRzinXarbnwKc+NRFFThu7kwzQT+cKlk=; b=USKUZpaQUyxJgoKu+YgVaS87z GOdD8SL9ApeobE49FpZQ3OHiv72WDa5kBdMe3QYTLWkWbzsE+7Wx0LWHvWDPaYmppOWbRTQTcpWUU vPCOX1cuyfMP/tpE3R4zhFr0umWTACdN4xLNQwt2DT8dc5JS7gY4kwyJA1sgEMDrhozo3VNq8IWLL RbsiaM7YVfA/jvGwRQJ5vBf4yvLkq/ekLsz0rUpOMvp4nXWomYQCVjPlEbKT9vOrnbuxjPqbsBYb0 nqhwAXyvURmr2Kjn9J3bK45CVo0wedSk/YElpZWjcybkoHQRtfVBAeodOjM7WhUxwfQHUFZwQFA6j X1tKS7D3g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtwcC-0003T4-Oj; Fri, 10 Jul 2020 17:15:12 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtwcB-0003Sr-2r for linux-arm-kernel@merlin.infradead.org; Fri, 10 Jul 2020 17:15:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=EO3VvEBF28l/MmUxV05wveqwlIIeMHFvl1Bw4u6rAn8=; b=r/BHNwavKRqMNzTwICQmAjAxT/ vv5ohKPt53Bz/JnxonY7FeDVA2UE3SWUUooD1rSSgp5uDShGk7jD6aIUqpvDanu42lM3RDtDJiW1o 2QPdDTLA45+GTICAzNmSJ+ojQX1pY3CpJA/bybL9io9jHY61co+nr1rEYF2TCor3HS6Bg3WZwYQBq X/H2W9bHC3MuI+hSSv14EdZYc8DFBNv8xqNataXUtdUA+ilVctSLAufLHA8Z0UVjnmNHg20ZTViVP wADU6crdJWRfHvNjjmrPV4u5DhIcmV6MlPYSc1+P5sUR+Xk199d63GvYj2BUWO/d1MSq/UuNIGVwV RZitBnWQ==; Received: from mail.kernel.org ([198.145.29.99]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtwHC-00055V-M1 for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 16:53:34 +0000 Received: from localhost.localdomain (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B55622088E; Fri, 10 Jul 2020 16:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594400005; bh=LR8dBleig5bp1XLGziGnSImBpDxiwU3kSRcm9I/nbOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TiqVi3ir8fjNZOxbgWpGPrF1iE/wAQqdbY2lOQuoY21U42vnZ03EAsV2JRq3eYsTB FGLrHDgj5xB6q+W9XaKm2XN0AfSkS0zhzkU2lsgnYLrx70umIx3DnzN/rGkrx4x+22 Nkvm6NAwhxlYK0CXjYqlEvkIwWe9GnPlv2jA5PO0= From: Will Deacon <will@kernel.org> To: linux-kernel@vger.kernel.org Subject: [PATCH v3 18/19] arm64: alternatives: Remove READ_ONCE() usage during patch operation Date: Fri, 10 Jul 2020 17:52:02 +0100 Message-Id: <20200710165203.31284-19-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200710165203.31284-1-will@kernel.org> References: <20200710165203.31284-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_175331_697780_E5481A39 X-CRM114-Status: GOOD ( 15.27 ) X-Spam-Score: -7.1 (-------) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-7.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Joel Fernandes <joelaf@google.com>, Mark Rutland <mark.rutland@arm.com>, "Michael S. Tsirkin" <mst@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Catalin Marinas <catalin.marinas@arm.com>, Jason Wang <jasowang@redhat.com>, virtualization@lists.linux-foundation.org, Will Deacon <will@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Alan Stern <stern@rowland.harvard.edu>, Sami Tolvanen <samitolvanen@google.com>, Matt Turner <mattst88@gmail.com>, kernel-team@android.com, Marco Elver <elver@google.com>, Kees Cook <keescook@chromium.org>, "Paul E. McKenney" <paulmck@kernel.org>, Boqun Feng <boqun.feng@gmail.com>, Ivan Kokshaysky <ink@jurassic.park.msu.ru>, linux-arm-kernel@lists.infradead.org, Richard Henderson <rth@twiddle.net>, Nick Desaulniers <ndesaulniers@google.com>, linux-alpha@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org |
Series |
Allow architectures to override __READ_ONCE()
|
expand
|
diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c index d1757ef1b1e7..87bca8d44084 100644 --- a/arch/arm64/kernel/alternative.c +++ b/arch/arm64/kernel/alternative.c @@ -21,7 +21,8 @@ #define ALT_ORIG_PTR(a) __ALT_PTR(a, orig_offset) #define ALT_REPL_PTR(a) __ALT_PTR(a, alt_offset) -static int all_alternatives_applied; +/* Volatile, as we may be patching the guts of READ_ONCE() */ +static volatile int all_alternatives_applied; static DECLARE_BITMAP(applied_alternatives, ARM64_NCAPS); @@ -217,7 +218,7 @@ static int __apply_alternatives_multi_stop(void *unused) /* We always have a CPU 0 at this point (__init) */ if (smp_processor_id()) { - while (!READ_ONCE(all_alternatives_applied)) + while (!all_alternatives_applied) cpu_relax(); isb(); } else { @@ -229,7 +230,7 @@ static int __apply_alternatives_multi_stop(void *unused) BUG_ON(all_alternatives_applied); __apply_alternatives(®ion, false, remaining_capabilities); /* Barriers provided by the cache flushing */ - WRITE_ONCE(all_alternatives_applied, 1); + all_alternatives_applied = 1; } return 0;
In preparation for patching the internals of READ_ONCE() itself, replace its usage on the alternatives patching patch with a volatile variable instead. Signed-off-by: Will Deacon <will@kernel.org> --- arch/arm64/kernel/alternative.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)