From: David Laight <david.laight.linux@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: odd objtool 'unreachable instruction' warning
Date: Wed, 29 Oct 2025 13:00:57 +0000 [thread overview]
Message-ID: <20251029130057.70a8f487@pumpkin> (raw)
In-Reply-To: <20251029100533.GF3419281@noisy.programming.kicks-ass.net>
On Wed, 29 Oct 2025 11:05:33 +0100
Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, Oct 29, 2025 at 09:56:38AM +0000, David Laight wrote:
> > On Tue, 28 Oct 2025 12:29:11 -0700
> > Linus Torvalds <torvalds@linux-foundation.org> wrote:
> >
> > > Josh, Peter,
> > > due to another entirely unrelated discussion, I ended up resurrecting
> > > my "make asm readable" patch that I have had in my local tree when I
> > > want to look at the actual generated code for user accesses.
> > >
> > > That is a local hack that just removes the alternative noise for the
> > > common ops, so that I actually see the fences and clac/stac
> > > instructions as such, instead of seeing them as nops in the object
> > > file or as horrible noise in the assembler output.
> >
> > I've toyed with using explicit nop sequences that would be identifiable
> > as stac, clac and lfence.
> >
> > At least that would tell you which is which.
> >
> > Since the flags can be trashed there are plenty to choose from.
> > (eg all the cmpb $n,%reg if you don't mind a false dependency.)
>
> As long as you ensure that insn_is_nop() recognises it as such, they
> won't actually ever get ran after alternative patching, since they'll be
> rewritten in canonical nops by optimize_nops().
Ah - I've wondered about the 'nop; nop; nop' being slightly sub-optimal.
But it is hard enough to see what happens to the alternative that is
selected never mind the ones that aren't.
Instructions that change the flags can't be changed to nops.
So possibly the best options are the 0f-1f-cx (for x 0..7).
So 'long_nop %reg' rather than 0f-1f-00 'long_nop [%rax]'.
(But I've not checked the full rules for the addressing modes of
'long_nop'.)
David
next prev parent reply other threads:[~2025-10-29 13:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 19:29 odd objtool 'unreachable instruction' warning Linus Torvalds
2025-10-29 0:21 ` Josh Poimboeuf
2025-10-29 0:59 ` Linus Torvalds
2025-10-29 1:50 ` Josh Poimboeuf
2025-10-29 16:17 ` Linus Torvalds
2025-10-30 9:51 ` Alexandre Chartre
2025-11-05 19:51 ` David Sterba
2025-11-07 0:05 ` Linus Torvalds
2025-10-29 9:56 ` David Laight
2025-10-29 10:05 ` Peter Zijlstra
2025-10-29 13:00 ` David Laight [this message]
2025-10-29 14:05 ` Peter Zijlstra
2025-11-01 7:05 ` Ingo Molnar
2025-11-01 16:59 ` Linus Torvalds
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=20251029130057.70a8f487@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.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