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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 37FEDC433F5 for ; Fri, 10 Dec 2021 14:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4Uj8mubfxMoFiuYltGHoVFXtkojXexhvcgkJXDNlIAY=; b=KEP5OBQACrcuXE /JwfeP7iRhe40oD6ySLEDF1/XUeIyfglphhBh6p6OXkeM9bbojUCyRbpE3cHWiIqmqh+gwQVRUtkO O2QScaEjSRHgFu1e4asfGlAAQ+LBeb34+WR+wTvII11TXIkUPi/j6wGxvSCGCXFyfDkP3/ldj2ZLc qVDLd2CzzDEJTXLEhmUerbBUZBk3d36wT82d105guKLoqrsK+b2F4n9AX2BfiWOH3uZp2uiYhoPkO 2QXws/SJt1vjByRf30uXzr1uGi5eSGdMwsjl6jbxmxqf4R+Px0298r6gUYLZhWIzLGGbehByLIcrj a+ZCxY+pzRyp8xQdUutg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvhDy-002FjO-BQ; Fri, 10 Dec 2021 14:50:14 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvhDv-002FiH-7u for linux-arm-kernel@lists.infradead.org; Fri, 10 Dec 2021 14:50:12 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7A516CE29C8; Fri, 10 Dec 2021 14:50:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 155C9C00446; Fri, 10 Dec 2021 14:50:02 +0000 (UTC) Date: Fri, 10 Dec 2021 14:49:59 +0000 From: Catalin Marinas To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, andre.przywara@arm.com, ardb@kernel.org, james.morse@arm.com, joey.gouly@arm.com, suzuki.poulose@arm.com, will@kernel.org Subject: Re: [PATCH 1/4] arm64: alternative: wait for other CPUs before patching Message-ID: References: <20211203104723.3412383-1-mark.rutland@arm.com> <20211203104723.3412383-2-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211203104723.3412383-2-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211210_065011_490468_E3C231EC X-CRM114-Status: GOOD ( 16.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 On Fri, Dec 03, 2021 at 10:47:20AM +0000, Mark Rutland wrote: > In __apply_alternatives_multi_stop() we have a "really simple polling > protocol" to avoid patching code that is concurrently executed on other > CPUs. Secondary CPUs wait for the boot CPU to signal that patching is > complete, but the boot CPU doesn't wait for secondaries to enter the > polling loop, and it's possible that patching starts while secondaries > are still within the stop_machine logic. > > Let's fix this by adding a vaguely simple polling protocol where the > boot CPU waits for secondaries to signal that they have entered the > unpatchable stop function. We can use the arch_atomic_*() functions for > this, as they are not patched with alternatives. > > At the same time, let's make `all_alternatives_applied` local to > __apply_alternatives_multi_stop(), since it is only used there, and this > makes the code a little clearer. Doesn't the stop_machine() mechanism wait for the CPUs to get in the same state before calling our function or we need another stop at a lower level in the arch code? -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel