All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64/sve: Remove redundant system_supports_sve() tests
@ 2021-04-12 17:23 Mark Brown
  2021-04-13 11:49 ` Catalin Marinas
  2021-04-14 10:06 ` Catalin Marinas
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Brown @ 2021-04-12 17:23 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon; +Cc: Dave Martin, linux-arm-kernel, Mark Brown

Currently there are a number of places in the SVE code where we check both
system_supports_sve() and TIF_SVE. This is a bit redundant given that we
should never get into a situation where we have set TIF_SVE without having
SVE support and it is not clear that silently ignoring a mistakenly set
TIF_SVE flag is the most sensible error handling approach. For now let's
just drop the system_supports_sve() checks since this will at least reduce
overhead a little.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/kernel/fpsimd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index 062b21f30f94..734d9ea37ecf 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -285,7 +285,7 @@ static void task_fpsimd_load(void)
 	WARN_ON(!system_supports_fpsimd());
 	WARN_ON(!have_cpu_fpsimd_context());
 
-	if (system_supports_sve() && test_thread_flag(TIF_SVE))
+	if (test_thread_flag(TIF_SVE))
 		sve_load_state(sve_pffr(&current->thread),
 			       &current->thread.uw.fpsimd_state.fpsr,
 			       sve_vq_from_vl(current->thread.sve_vl) - 1);
@@ -307,7 +307,7 @@ static void fpsimd_save(void)
 	WARN_ON(!have_cpu_fpsimd_context());
 
 	if (!test_thread_flag(TIF_FOREIGN_FPSTATE)) {
-		if (system_supports_sve() && test_thread_flag(TIF_SVE)) {
+		if (test_thread_flag(TIF_SVE)) {
 			if (WARN_ON(sve_get_vl() != last->sve_vl)) {
 				/*
 				 * Can't save the user regs, so current would
@@ -1092,7 +1092,7 @@ void fpsimd_preserve_current_state(void)
 void fpsimd_signal_preserve_current_state(void)
 {
 	fpsimd_preserve_current_state();
-	if (system_supports_sve() && test_thread_flag(TIF_SVE))
+	if (test_thread_flag(TIF_SVE))
 		sve_to_fpsimd(current);
 }
 
@@ -1181,7 +1181,7 @@ void fpsimd_update_current_state(struct user_fpsimd_state const *state)
 	get_cpu_fpsimd_context();
 
 	current->thread.uw.fpsimd_state = *state;
-	if (system_supports_sve() && test_thread_flag(TIF_SVE))
+	if (test_thread_flag(TIF_SVE))
 		fpsimd_to_sve(current);
 
 	task_fpsimd_load();
-- 
2.20.1


_______________________________________________
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] 3+ messages in thread

* Re: [PATCH] arm64/sve: Remove redundant system_supports_sve() tests
  2021-04-12 17:23 [PATCH] arm64/sve: Remove redundant system_supports_sve() tests Mark Brown
@ 2021-04-13 11:49 ` Catalin Marinas
  2021-04-14 10:06 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2021-04-13 11:49 UTC (permalink / raw)
  To: Mark Brown; +Cc: Will Deacon, Dave Martin, linux-arm-kernel

On Mon, Apr 12, 2021 at 06:23:20PM +0100, Mark Brown wrote:
> Currently there are a number of places in the SVE code where we check both
> system_supports_sve() and TIF_SVE. This is a bit redundant given that we
> should never get into a situation where we have set TIF_SVE without having
> SVE support and it is not clear that silently ignoring a mistakenly set
> TIF_SVE flag is the most sensible error handling approach. For now let's
> just drop the system_supports_sve() checks since this will at least reduce
> overhead a little.

It makes sense. The only advantage is if CONFIG_ARM64_SVE is disabled,
we avoid an extra check but with defconfig that's always on.

-- 
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] 3+ messages in thread

* Re: [PATCH] arm64/sve: Remove redundant system_supports_sve() tests
  2021-04-12 17:23 [PATCH] arm64/sve: Remove redundant system_supports_sve() tests Mark Brown
  2021-04-13 11:49 ` Catalin Marinas
@ 2021-04-14 10:06 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2021-04-14 10:06 UTC (permalink / raw)
  To: Will Deacon, Mark Brown; +Cc: Catalin Marinas, Dave Martin, linux-arm-kernel

On Mon, 12 Apr 2021 18:23:20 +0100, Mark Brown wrote:
> Currently there are a number of places in the SVE code where we check both
> system_supports_sve() and TIF_SVE. This is a bit redundant given that we
> should never get into a situation where we have set TIF_SVE without having
> SVE support and it is not clear that silently ignoring a mistakenly set
> TIF_SVE flag is the most sensible error handling approach. For now let's
> just drop the system_supports_sve() checks since this will at least reduce
> overhead a little.

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

[1/1] arm64/sve: Remove redundant system_supports_sve() tests
      https://git.kernel.org/arm64/c/ef9c5d09797d

-- 
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] 3+ messages in thread

end of thread, other threads:[~2021-04-14 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 17:23 [PATCH] arm64/sve: Remove redundant system_supports_sve() tests Mark Brown
2021-04-13 11:49 ` Catalin Marinas
2021-04-14 10:06 ` Catalin Marinas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.