[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250925100323.GY4067720@noisy.programming.kicks-ass.net>
Date: Thu, 25 Sep 2025 12:03:23 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Alexandre Chartre <alexandre.chartre@...cle.com>
Cc: jpoimboe@...nel.org, x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] objtool/x86: Fix NOP decode
On Thu, Sep 25, 2025 at 11:55:23AM +0200, Alexandre Chartre wrote:
>
> On 9/24/25 20:41, Peter Zijlstra wrote:
> > On Wed, Sep 24, 2025 at 07:34:00PM +0200, Alexandre Chartre wrote:
> > >
> > > On 9/24/25 15:45, Peter Zijlstra wrote:
> > > > For x86_64 the kernel consistently uses 2 instructions for all NOPs:
> > > >
> > > > 90 - NOP
> > > > 0f 1f /0 - NOPL
> > > >
> > > >
> > > > Notably:
> > > >
> > > > - REP NOP is PAUSE, not a NOP instruction.
> > > >
> > > > - 0f {0c...0f} is reserved space,
> > > > except for 0f 0d /1, which is PREFETCHW, not a NOP.
> > > >
> > > > - 0f {19,1c...1f} is reserved space,
> > > > except for 0f 1f /0, which is NOPL.
> > > >
> > > > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> > > > ---
> > > > tools/objtool/arch/x86/decode.c | 12 +++++++-----
> > > > 1 file changed, 7 insertions(+), 5 deletions(-)
> > > >
> > > > --- a/tools/objtool/arch/x86/decode.c
> > > > +++ b/tools/objtool/arch/x86/decode.c
> > > > @@ -494,7 +494,8 @@ int arch_decode_instruction(struct objto
> > > > break;
> > > > case 0x90:
> > > > + if (prefix != 0xf3) /* REP NOP := PAUSE */
> > > > + insn->type = INSN_NOP;
> > > > break;
> > >
> > > So this covers NOP1 (0x90) and NOP2 (0x66 0x90), right?
> >
> > Yes. Everything with opcode 0x90, except 0xf3 0x90, which as stated is
> > PAUSE.
> >
>
> What about 0x49 0x90, which is xchg (XCHG r8,rAX) ?
Ooh, that is a nice one. Yes, that needs fixing. Thanks!
Powered by blists - more mailing lists