From patchwork Tue Jun 18 14:03:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13702437 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 F0CC4C27C4F for ; Tue, 18 Jun 2024 14:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=1U4fxGoneHmD00otYDIEl7BlN4pI+WfPIj5V244tJ9w=; b=Jn8J1LEFqz1U6ACPBECQZkw+wR mQJeMkFsmpafNnQkn5sBySYBrXmEUV0e7vr2WFDXb85Mx/ubtwhPu0WSisqMdt+zM4pYQIkRSlkAe uIGhrQXQ7eOU6MWAYUWVZhZWs+9NrF2pfRPmuK+OYWoLrM3tizbDvBEacwXJJYNGeIWAnl8hKy8Zb kBpXlUgc7WgzkMQ6XvI6iLFoKUe9rwpQAZDSzVx5i7RevgDoW3MPrgCSOnn7tqhH1XevFa3JcD+MH ktIEBhowu1GjqbbO+mtX4ylarIFRU+6zQTFjf9SYn4sKMrFYpRGDXzePQ+WWXUr5cZU9GFajyyQx1 nz3rK23g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJZSr-0000000FHqY-1l4d; Tue, 18 Jun 2024 14:05:37 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJZSn-0000000FHoF-17AK for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2024 14:05:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 637EDCE1B80; Tue, 18 Jun 2024 14:05:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 009C4C3277B; Tue, 18 Jun 2024 14:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718719528; bh=voUsZu4+P8cVPFpKsisVJUT4+hz+waGqy6KYjg3O6XU=; h=From:Date:Subject:To:Cc:From; b=cxOGMpVp/uVKJnoBTxmmDq2a6L/KRzgLcPVWECOqziTVSLE+nRbXhcH/AT0tLUBAL h8M+t8rVGsu8JTdLjCfELjM/CzKgBHKxCvYmI2bfD+JMeNZ768pBdPwU98mA8K+Trc MkOAy2yvom4y8ztPyhdVRNFC2/Pmgbj4211Fgfgq3tOLIXdLE9WiRnxyEO7RDdegMK jH1z48fF8GyzDdj/CXR8K7yfkqq4hxCvYe9vhSqaW2mXyJL+vjEihAvZJFlrOANh/z Bt1IliRmBX2PC+sciovs5QCGWdUkTGjqDPrd7ioA/goFd8WASSJjezoNVAqPPsT5rh /l4pOUdrKc/Ow== From: Mark Brown Date: Tue, 18 Jun 2024 15:03:50 +0100 Subject: [PATCH] arm64/fpsimd: Ensure that offlined CPUs are not using SME MIME-Version: 1.0 Message-Id: <20240618-arm64-fpsimd-sme-cpu-die-v1-1-9a90d1a34918@kernel.org> X-B4-Tracking: v=1; b=H4sIAMWTcWYC/x3MMQqAMAxA0atIZgM1qAWvIg7SppqhWhoUQXp3i +Mb/n9BOQsrTM0LmW9ROY+Krm3A7euxMYqvBjLUm7GzuOY49hiSSvSokdGlC70wDpbM4GwgMgw 1T5mDPP96Xkr5AByMX9FqAAAA To: Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.14-dev-d4707 X-Developer-Signature: v=1; a=openpgp-sha256; l=1642; i=broonie@kernel.org; h=from:subject:message-id; bh=voUsZu4+P8cVPFpKsisVJUT4+hz+waGqy6KYjg3O6XU=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmcZQlOfUtP8GynkL5ciAZnGDT43rip612ZKqNulU0 2D9L3f2JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZnGUJQAKCRAk1otyXVSH0HPIB/ 9qFQFzf6Kv8FGh2lCNWkw7r022T8RQMu2t56+VvJjGjE2R/wZjzeH1OCrQ5jXScZMqonk5JJ2burg+ MkRKiHfE2oRNicvBkgdbqpSxyJKIvamJdv/TOOBastjQHzZLKMyKiVqNJwYFzFUOzY3HgE2qmlLrnM boRTkBuo7GDIIC1zFfKPrxAIqAAseWscgpuoKdl9qtSjhk11w+/lNDh8XsZoPPOn2MtUyWYXXGMrRC 1Ykk3oOzJBy9lVsgbcDgPod3xwjWn7XxLU4rnuizGmoCOXfl4yGk8U/il+2CzvBrqXN60yq9DK3Jne ItSqnzNlEni1RNRPQE6WNz8NA6tZLx X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240618_070533_594969_898BB5B4 X-CRM114-Status: GOOD ( 14.45 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When we use CPU hotplug to offline a CPU we may transition directly from running a task which was using SME to the CPU being offlined. This means that PSTATE.{SM,ZA} may still be set, indicating to the system that SME is still in use. This could create contention with other still running CPUs if the system uses shared SMCUs. For most systems this shouldn't be an issue, we should have PSCI or some other power management mechanism which will take care of this as part of offlining the CPU. However we do still have support for spin tables, and it is possible that system firmware may not be ideally implemented, so let's explicitly disable SME during the process of offlining the CPU in order to ensure there's no spurious contention. Signed-off-by: Mark Brown --- arch/arm64/kernel/smp.c | 4 ++++ 1 file changed, 4 insertions(+) --- base-commit: 83a7eefedc9b56fe7bfeff13b6c7356688ffa670 change-id: 20240617-arm64-fpsimd-sme-cpu-die-57205c7f220e Best regards, diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 31c8b3094dd7..9e8fc6ac758a 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -383,6 +383,10 @@ void __noreturn cpu_die(void) /* Tell cpuhp_bp_sync_dead() that this CPU is now safe to dispose of */ cpuhp_ap_report_dead(); + /* Ensure we are not spuriously contending any SMCU */ + if (system_supports_sme()) + sme_smstop(); + /* * Actually shutdown the CPU. This must never fail. The specific hotplug * mechanism must perform all required cache maintenance to ensure that