From: Keno Fischer <keno@juliacomputing.com>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, cl@linux.com, Tejun Heo <tj@kernel.org>
Subject: [PATCH] x86/percpu: Fix assembly in variable_test_bit
Date: Wed, 18 Mar 2020 01:25:09 -0400 [thread overview]
Message-ID: <20200318052509.GA23121@juliacomputing.com> (raw)
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
reply other threads:[~2020-03-18 5:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200318052509.GA23121@juliacomputing.com \
--to=keno@juliacomputing.com \
--cc=bp@alien8.de \
--cc=cl@linux.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.