linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] arm64/fpsimd: Exit streaming mode when flushing tasks
@ 2023-06-09 22:43 Mark Brown
  2023-06-16 17:45 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2023-06-09 22:43 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: linux-arm-kernel, linux-kernel, Anders Roxell, Naresh Kamboju,
	Mark Brown

Ensure there is no path where we might attempt to save SME state after we
flush a task by updating the SVCR register state as well as updating our
in memory state. I haven't seen a specific case where this is happening or
seen a path where it might happen but for the cost of a single low overhead
instruction it seems sensible to close the potential gap.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
Changes in v2:
- Do a full SMSTOP to cover ZA as well.
- Link to v1: https://lore.kernel.org/r/20230607-arm64-flush-svcr-v1-1-7821a6199e0a@kernel.org
---
 arch/arm64/kernel/fpsimd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index 2fbafa5cc7ac..7a1aeb95d7c3 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -1649,6 +1649,7 @@ void fpsimd_flush_thread(void)
 
 		fpsimd_flush_thread_vl(ARM64_VEC_SME);
 		current->thread.svcr = 0;
+		sme_smstop();
 	}
 
 	current->thread.fp_type = FP_STATE_FPSIMD;

---
base-commit: 44c026a73be8038f03dbdeef028b642880cf1511
change-id: 20230607-arm64-flush-svcr-47cc76a8cbbc

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] arm64/fpsimd: Exit streaming mode when flushing tasks
  2023-06-09 22:43 [PATCH v2] arm64/fpsimd: Exit streaming mode when flushing tasks Mark Brown
@ 2023-06-16 17:45 ` Catalin Marinas
  0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2023-06-16 17:45 UTC (permalink / raw)
  To: Will Deacon, Mark Brown
  Cc: linux-arm-kernel, linux-kernel, Anders Roxell, Naresh Kamboju

On Fri, 09 Jun 2023 23:43:41 +0100, Mark Brown wrote:
> Ensure there is no path where we might attempt to save SME state after we
> flush a task by updating the SVCR register state as well as updating our
> in memory state. I haven't seen a specific case where this is happening or
> seen a path where it might happen but for the cost of a single low overhead
> instruction it seems sensible to close the potential gap.
> 
> 
> [...]

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64/fpsimd: Exit streaming mode when flushing tasks
      https://git.kernel.org/arm64/c/af3215fd0230

-- 
Catalin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-06-16 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09 22:43 [PATCH v2] arm64/fpsimd: Exit streaming mode when flushing tasks Mark Brown
2023-06-16 17:45 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).