mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arm64/fpsimd: Ensure that offlined CPUs are not using SME
@ 2024-06-18 14:03 Mark Brown
  2024-06-18 14:51 ` Mark Rutland
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2024-06-18 14:03 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon; +Cc: linux-arm-kernel, linux-kernel, Mark Brown

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 <broonie@kernel.org>
---
 arch/arm64/kernel/smp.c | 4 ++++
 1 file changed, 4 insertions(+)

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

---
base-commit: 83a7eefedc9b56fe7bfeff13b6c7356688ffa670
change-id: 20240617-arm64-fpsimd-sme-cpu-die-57205c7f220e

Best regards,
-- 
Mark Brown <broonie@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-18 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-18 14:03 [PATCH] arm64/fpsimd: Ensure that offlined CPUs are not using SME Mark Brown
2024-06-18 14:51 ` Mark Rutland
2024-06-18 15:43   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®