* [PATCH] x86/percpu: Fix assembly in variable_test_bit
@ 2020-03-18 5:25 Keno Fischer
0 siblings, 0 replies; only message in thread
From: Keno Fischer @ 2020-03-18 5:25 UTC (permalink / raw)
To: linux-kernel
Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
x86, cl, Tejun Heo
I was trying to compile the kernel with -Og for a better debugging
experience. One side effect of this that the compiler will no longer
do as aggressive dead code elimination, so assembly blocks that were
previously dce'd remained in the final assembly. There's quite a number
of places in the kernel that rely on this dce happening, so it's not
clear that this should be a supported configuration. Nevertheless,
in this particular instance, I believe it found a real issue. In
particular, I believe the `__percpu_arg` macro should be on the
memory operand rather than the immediate. As far as I can tell,
this was never correct, but just happened to be always dce'd out
because the cpu_test macro is generally only used with constant
`nr` arguments.
Fixes: 349c004e3d31 ("x86: A fast way to check capabilities of the current cpu")
Signed-off-by: Keno Fischer <keno@juliacomputing.com>
---
arch/x86/include/asm/percpu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 2278797c769d..17c7677e6cdd 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -539,7 +539,7 @@ static inline bool x86_this_cpu_variable_test_bit(int nr,
{
bool oldbit;
- asm volatile("btl "__percpu_arg(2)",%1"
+ asm volatile("btl %2,"__percpu_arg(1)"\n\t"
CC_SET(c)
: CC_OUT(c) (oldbit)
: "m" (*(unsigned long __percpu *)addr), "Ir" (nr));
--
2.24.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-18 5:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-18 5:25 [PATCH] x86/percpu: Fix assembly in variable_test_bit Keno Fischer
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.