From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 882FDC2D0A3 for ; Tue, 3 Nov 2020 12:18:37 +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 050A521D40 for ; Tue, 3 Nov 2020 12:18:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="c11Deo/u"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="kw3wHPhX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 050A521D40 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+linux-arm-kernel=archiver.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=mt4aS36JacCeWLNYfO8vEPsoUcDOlf6VUV65SG3lTB8=; b=c11Deo/umy/fa4xdhLQbfC8v/ oWeFCqUc63jT9/wBdJkOSQNgrGG2MDleOnURW6wlnLD4ZYcC+yGbMaWiaMJPLodYwyIRh00SHKrwD EPtI+lzY40v+Y4fX1ZC65vFI7LYAJ3mJe3L9e8UFM6nPdC6OHMKiZhPO9RuuK1wk6DNULSqUKMIZs isyvD5FVKheOxlzlmoGJ869YlRXxwvD1BgkdLDnjGupS3k3JyUcLdGZQMC59UR40uf77owQH7nUmS cFou+Y8POlokCbBqahG4Rq4K0aABao7fZfu7Gw+/mxQ9uLz9o8NOZF4Z8D8LNTxetH2a/Tyo+bToe WQExNxa8Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZvGC-0008HU-SW; Tue, 03 Nov 2020 12:18:00 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZvFm-00088c-Rr for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2020 12:17:37 +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 5EFC92240C; Tue, 3 Nov 2020 12:17:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604405853; bh=BCgiu9K0Vqk44ZIzAPpCiD5ozFp8P1v2e6umqroeIWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kw3wHPhXk4rskprK8mBpamdvL2GCzA8ksI4tAq5mCcBT1gkO5UV5Nr+73FKJpd4Bv Uu9H8Eq2lWNvAmd1aQvkQPz9JK+6yhGFCzb/p8V4y3ZTvq9fslGrG0Uhpw1b9Jxyra I6cSgsNvF/t5+WY9+OuSNvGDTja250yeCyedtKr0= From: Will Deacon To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 3/4] arm64: alternatives: Remove READ_ONCE() usage during patch operation Date: Tue, 3 Nov 2020 12:17:20 +0000 Message-Id: <20201103121721.5166-4-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201103121721.5166-1-will@kernel.org> References: <20201103121721.5166-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201103_071735_066432_A89B1AE8 X-CRM114-Status: GOOD ( 14.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , Peter Zijlstra , Catalin Marinas , Masahiro Yamada , linux-kernel@vger.kernel.org, Sami Tolvanen , Will Deacon Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In preparation for patching the internals of READ_ONCE() itself, replace its usage on the alternatives patching patch with a volatile variable instead. Acked-by: Peter Zijlstra (Intel) Signed-off-by: Will Deacon --- arch/arm64/kernel/alternative.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c index 73039949b5ce..a57cffb752e8 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); @@ -205,7 +206,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 { @@ -217,7 +218,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; -- 2.29.1.341.ge80a0c044ae-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel