From: Josh Poimboeuf <jpoimboe@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH RFC 2/5] objtool, x86/hweight: Remove ANNOTATE_IGNORE_ALTERNATIVE
Date: Tue, 8 Apr 2025 01:21:15 -0700 [thread overview]
Message-ID: <e2be2dfe46dbe432375f2fafcb1dbdce1143af99.1744098446.git.jpoimboe@kernel.org> (raw)
In-Reply-To: <cover.1744098446.git.jpoimboe@kernel.org>
Since objtool's inception, frame pointer warnings have been manually
silenced for __arch_hweight*() to allow those functions' inline asm to
avoid using ASM_CALL_CONSTRAINT.
The potentially dubious reasoning for that decision over nine years ago
was that since !X86_FEATURE_POPCNT is exceedingly rare, it's not worth
hurting the code layout for a function call that will never happen on
the vast majority of systems.
However, those functions actually started using ASM_CALL_CONSTRAINT with
the following commit:
194a613088a8 ("x86/hweight: Use ASM_CALL_CONSTRAINT in inline asm()")
And rightfully so, as it makes the code correct. ASM_CALL_CONSTRAINT
will soon have no effect for non-FP configs anyway.
With ASM_CALL_CONSTRAINT in place, ANNOTATE_IGNORE_ALTERNATIVE no longer
has a purpose for the hweight functions. Remove it.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
arch/x86/include/asm/arch_hweight.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h
index cbc6157f0b4b..b5982b94bdba 100644
--- a/arch/x86/include/asm/arch_hweight.h
+++ b/arch/x86/include/asm/arch_hweight.h
@@ -16,8 +16,7 @@ static __always_inline unsigned int __arch_hweight32(unsigned int w)
{
unsigned int res;
- asm_inline (ALTERNATIVE(ANNOTATE_IGNORE_ALTERNATIVE
- "call __sw_hweight32",
+ asm_inline (ALTERNATIVE("call __sw_hweight32",
"popcntl %[val], %[cnt]", X86_FEATURE_POPCNT)
: [cnt] "=" REG_OUT (res), ASM_CALL_CONSTRAINT
: [val] REG_IN (w));
@@ -46,8 +45,7 @@ static __always_inline unsigned long __arch_hweight64(__u64 w)
{
unsigned long res;
- asm_inline (ALTERNATIVE(ANNOTATE_IGNORE_ALTERNATIVE
- "call __sw_hweight64",
+ asm_inline (ALTERNATIVE("call __sw_hweight64",
"popcntq %[val], %[cnt]", X86_FEATURE_POPCNT)
: [cnt] "=" REG_OUT (res), ASM_CALL_CONSTRAINT
: [val] REG_IN (w));
--
2.49.0
next prev parent reply other threads:[~2025-04-08 8:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 8:21 [PATCH RFC 0/5] x86/asm: Improve code generation Josh Poimboeuf
2025-04-08 8:21 ` [PATCH RFC 1/5] objtool: Remove ANNOTATE_IGNORE_ALTERNATIVE from CLAC/STAC Josh Poimboeuf
2025-04-08 18:07 ` Linus Torvalds
2025-04-08 20:45 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-08 8:21 ` Josh Poimboeuf [this message]
2025-04-08 8:21 ` [PATCH RFC 3/5] noinstr: Use asm_inline() in instrumentation_{begin,end}() Josh Poimboeuf
2025-04-08 8:30 ` Ingo Molnar
2025-04-08 11:10 ` Uros Bizjak
2025-04-08 16:46 ` Josh Poimboeuf
2025-04-08 8:21 ` [PATCH RFC 4/5] x86/alternative: Improve code generation readability Josh Poimboeuf
2025-04-09 14:38 ` Peter Zijlstra
2025-04-09 17:41 ` Josh Poimboeuf
2025-04-09 18:02 ` Linus Torvalds
2025-04-09 19:51 ` Josh Poimboeuf
2025-04-09 21:20 ` Linus Torvalds
2025-04-09 21:27 ` Josh Poimboeuf
2025-04-09 21:55 ` Josh Poimboeuf
2025-04-16 23:30 ` Josh Poimboeuf
2025-04-08 8:21 ` [PATCH RFC 5/5] objtool: " Josh Poimboeuf
2025-04-09 14:40 ` Peter Zijlstra
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=e2be2dfe46dbe432375f2fafcb1dbdce1143af99.1744098446.git.jpoimboe@kernel.org \
--to=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®