From: Borislav Petkov <bp@alien8.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Richard Narron <richard@aaazen.com>
Subject: Re: [PATCH] x86/alternative: Optimize single-byte NOPs at an arbitrary position
Date: Wed, 2 Jun 2021 12:37:32 +0200 [thread overview]
Message-ID: <YLdfbJBk20HIjfDE@zn.tnic> (raw)
In-Reply-To: <YLc+AniWgFBdMbX6@hirez.programming.kicks-ass.net>
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
next prev parent reply other threads:[~2021-06-02 10:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 21:21 [PATCH] x86/alternative: Optimize single-byte NOPs at an arbitrary position Borislav Petkov
2021-06-02 8:14 ` Peter Zijlstra
2021-06-02 10:37 ` Borislav Petkov [this message]
2021-06-02 19:49 ` [tip: x86/urgent] " tip-bot2 for Borislav Petkov
2021-06-03 14:38 ` tip-bot2 for Borislav Petkov
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=YLdfbJBk20HIjfDE@zn.tnic \
--to=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=richard@aaazen.com \
--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;
as well as URLs for NNTP newsgroup(s).