lkml.org 
[lkml]   [2021]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/alternative: Optimize single-byte NOPs at an arbitrary position
On Wed, Jun 02, 2021 at 10:14:58AM +0200, Peter Zijlstra wrote:
> Who again insisted that wouldn't happen? :-)

Yours truly, ofc. :-P

> That's almost a proper comment, might as well finish it
>
> /*
> * optimize_nops_range() - Optimize a sequence of single byte NOPs (0x90)
> * @instr: instruction byte stream
> * @instrlen: length of the above
> * @off: offset within @instr where the first NOP has been detected
> *
> * Return: number of NOPs found (and replaced)
> */

Done.

> for (; i < instrlen && instr[i] == 0x90; i++)
> ;
>
> perhaps? (possibly too dense, up to you)

Yeah, let's leave it simple so that one can read it at a quick glance.

> > +
> > + nnops = i - off;
> > +
> > + if (nnops <= 1)
> > + return nnops;
>
> !nnops would be an error, no?

Yeah, just being overly cautious. It should not be 0 since we're being
called for the byte at offset being 0x90. But I have said "should not
be" before and have fallen flat on my face.

> We really needs that extra line?

Zapped.

> Anyway, irrespective of nits:
>
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Thanks, all except one incorporated.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

\
 
 \ /
  Last update: 2021-06-02 12:38    [W:0.196 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site