x86/percpu: Fix assembly in variable_test_bit
Subsystems (2)
PATCH 1/1 x86/percpu: Fix assembly in variable_test_bit
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.
--- arch/x86/include/asm/percpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/percpu.h +1 -1
@@ -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));
Signature · 1 line
2.24.0