linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] um: fix and optimize xor select template for CONFIG64 and timetravel mode
@ 2022-01-11 20:05 Benjamin Beichler
  2022-01-12 10:03 ` Anton Ivanov
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Beichler @ 2022-01-11 20:05 UTC (permalink / raw)
  To: Jeff Dike, Richard Weinberger, Anton Ivanov
  Cc: johannes.berg, Benjamin Beichler, linux-um, linux-kernel

Due to dropped inclusion of asm-generic/xor.h, xor_block_8regs symbol is
missing with CONFIG64 and break compilation, as the asm/xor_64.h also did
not include it. The patch recreate the logic from arch/x86, which check
whether AVX is available and add fallbacks for 32bit and 64bit config of
um.

A very minor additional "fix" is, the return of the macro parameter
instead of NULL, as this is the original intent of the macro, but
this does not change the actual behavior.

Fixes: c0ecca6604b8 ("um: enable the use of optimized xor routines in UML")
Signed-off-by: Benjamin Beichler <benjamin.beichler@uni-rostock.de>
---
 arch/um/include/asm/xor.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/um/include/asm/xor.h b/arch/um/include/asm/xor.h
index f512704a9ec7..22b39de73c24 100644
--- a/arch/um/include/asm/xor.h
+++ b/arch/um/include/asm/xor.h
@@ -4,8 +4,10 @@
 
 #ifdef CONFIG_64BIT
 #undef CONFIG_X86_32
+#define TT_CPU_INF_XOR_DEFAULT (AVX_SELECT(&xor_block_sse_pf64))
 #else
 #define CONFIG_X86_32 1
+#define TT_CPU_INF_XOR_DEFAULT (AVX_SELECT(&xor_block_8regs))
 #endif
 
 #include <asm/cpufeature.h>
@@ -16,7 +18,7 @@
 #undef XOR_SELECT_TEMPLATE
 /* pick an arbitrary one - measuring isn't possible with inf-cpu */
 #define XOR_SELECT_TEMPLATE(x)	\
-	(time_travel_mode == TT_MODE_INFCPU ? &xor_block_8regs : NULL)
+	(time_travel_mode == TT_MODE_INFCPU ? TT_CPU_INF_XOR_DEFAULT : x))
 #endif
 
 #endif
-- 
2.25.1

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

* Re: [PATCH] um: fix and optimize xor select template for CONFIG64 and timetravel mode
  2022-01-11 20:05 [PATCH] um: fix and optimize xor select template for CONFIG64 and timetravel mode Benjamin Beichler
@ 2022-01-12 10:03 ` Anton Ivanov
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Ivanov @ 2022-01-12 10:03 UTC (permalink / raw)
  To: Benjamin Beichler, Jeff Dike, Richard Weinberger
  Cc: johannes.berg, linux-um, linux-kernel



On 11/01/2022 20:05, Benjamin Beichler wrote:
> Due to dropped inclusion of asm-generic/xor.h, xor_block_8regs symbol is
> missing with CONFIG64 and break compilation, as the asm/xor_64.h also did
> not include it. The patch recreate the logic from arch/x86, which check
> whether AVX is available and add fallbacks for 32bit and 64bit config of
> um.
> 
> A very minor additional "fix" is, the return of the macro parameter
> instead of NULL, as this is the original intent of the macro, but
> this does not change the actual behavior.
> 
> Fixes: c0ecca6604b8 ("um: enable the use of optimized xor routines in UML")
> Signed-off-by: Benjamin Beichler <benjamin.beichler@uni-rostock.de>
> ---
>   arch/um/include/asm/xor.h | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/um/include/asm/xor.h b/arch/um/include/asm/xor.h
> index f512704a9ec7..22b39de73c24 100644
> --- a/arch/um/include/asm/xor.h
> +++ b/arch/um/include/asm/xor.h
> @@ -4,8 +4,10 @@
>   
>   #ifdef CONFIG_64BIT
>   #undef CONFIG_X86_32
> +#define TT_CPU_INF_XOR_DEFAULT (AVX_SELECT(&xor_block_sse_pf64))
>   #else
>   #define CONFIG_X86_32 1
> +#define TT_CPU_INF_XOR_DEFAULT (AVX_SELECT(&xor_block_8regs))
>   #endif
>   
>   #include <asm/cpufeature.h>
> @@ -16,7 +18,7 @@
>   #undef XOR_SELECT_TEMPLATE
>   /* pick an arbitrary one - measuring isn't possible with inf-cpu */
>   #define XOR_SELECT_TEMPLATE(x)	\
> -	(time_travel_mode == TT_MODE_INFCPU ? &xor_block_8regs : NULL)
> +	(time_travel_mode == TT_MODE_INFCPU ? TT_CPU_INF_XOR_DEFAULT : x))
>   #endif
>   
>   #endif
> 
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

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

end of thread, other threads:[~2022-01-12 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 20:05 [PATCH] um: fix and optimize xor select template for CONFIG64 and timetravel mode Benjamin Beichler
2022-01-12 10:03 ` Anton Ivanov

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).