linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: hpa@zytor.com
Cc: Steven Rostedt <rostedt@goodmis.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: The killing of ideal_nops[]
Date: Wed, 10 Mar 2021 10:14:35 +0100	[thread overview]
Message-ID: <YEiN+/Zp4uE/ISWD@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <362BD2A4-016D-4F6B-8974-92C84DC0DDB4@zytor.com>

On Tue, Mar 09, 2021 at 04:33:45PM -0800, hpa@zytor.com wrote:
> On March 9, 2021 1:24:44 PM PST, Peter Zijlstra <peterz@infradead.org> wrote:
> >On Tue, Mar 09, 2021 at 12:05:19PM -0500, Steven Rostedt wrote:
> >> On Tue, 9 Mar 2021 17:58:17 +0100
> >> Peter Zijlstra <peterz@infradead.org> wrote:
> >> 
> >> > Hi,
> >> > 
> >> > AFAICT everything made in the past 10 years ends up using p6_nops.
> >Is it
> >> > time to kill off ideal_nops[] and simplify life?
> >> > 
> >> 
> >> Well, the one bug that was reported recently was due to a box that
> >uses a
> >> different "ideal_nops" than p6_nops. Perhaps we should ask him if
> >there's
> >> any noticeable difference between using p6_nops for every function
> >than the
> >> ideal_nops that as found for that box.
> >
> >If the machine is more than a decade old, I'm not really caring about
> >optimal performance. If it is 32bit, I really couldn't be arsed as long
> >as it boots.
> 
> p6_nops don't boot on all 32-bit chips.

Sure, but we can have one set on 32bit and another set on 64bit.

$ cat nops.s
.section .text
nop1: .nops 1
nop2: .nops 2
nop3: .nops 3
nop4: .nops 4
nop5: .nops 5
nop6: .nops 6
nop7: .nops 7
nop8: .nops 8

$ as --32 nops.s -o nops.o ; objdump -wd nops.o

nops.o:     file format elf32-i386


Disassembly of section .text:

00000000 <nop1>:
0:   90                      nop

00000001 <nop2>:
1:   66 90                   xchg   %ax,%ax

00000003 <nop3>:
3:   8d 76 00                lea    0x0(%esi),%esi

00000006 <nop4>:
6:   8d 74 26 00             lea    0x0(%esi,%eiz,1),%esi

0000000a <nop5>:
a:   8d 74 26 00             lea    0x0(%esi,%eiz,1),%esi
e:   90                      nop

0000000f <nop6>:
f:   8d b6 00 00 00 00       lea    0x0(%esi),%esi

00000015 <nop7>:
15:   8d b4 26 00 00 00 00    lea    0x0(%esi,%eiz,1),%esi

0000001c <nop8>:
1c:   8d b4 26 00 00 00 00    lea    0x0(%esi,%eiz,1),%esi
23:   90                      nop

$ as --64 nops.s -o nops.o ; objdump -wd nops.o

nops.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <nop1>:
0:   90                      nop

0000000000000001 <nop2>:
1:   66 90                   xchg   %ax,%ax

0000000000000003 <nop3>:
3:   0f 1f 00                nopl   (%rax)

0000000000000006 <nop4>:
6:   0f 1f 40 00             nopl   0x0(%rax)

000000000000000a <nop5>:
a:   0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

000000000000000f <nop6>:
f:   66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)

0000000000000015 <nop7>:
15:   0f 1f 80 00 00 00 00    nopl   0x0(%rax)

000000000000001c <nop8>:
1c:   0f 1f 84 00 00 00 00 00         nopl   0x0(%rax,%rax,1)


---

Although I would use DS prefix nops for 32bit nop5/nop8 to keep them
single instructions.

Then we can do away with runtime nop selection and special atomic nops
and simplify things.

All this runtime faffing about nops is tedious and causes complications
we can do without.

  reply	other threads:[~2021-03-10  9:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 16:58 The killing of ideal_nops[] Peter Zijlstra
2021-03-09 17:05 ` Steven Rostedt
2021-03-09 21:24   ` Peter Zijlstra
2021-03-10  0:33     ` hpa
2021-03-10  9:14       ` Peter Zijlstra [this message]
2021-03-10  9:35         ` Peter Zijlstra
2021-03-10 10:03           ` Peter Zijlstra
2021-03-10 10:22             ` Peter Zijlstra
2021-03-10 14:13               ` Steven Rostedt
2021-03-10 14:24                 ` Peter Zijlstra
2021-03-10 14:30                   ` Peter Zijlstra
2021-03-10 15:48                   ` Alexei Starovoitov
2021-03-10 16:04                     ` Peter Zijlstra
2021-03-11  9:28                       ` David Laight
2021-03-14 22:43                       ` Maciej W. Rozycki

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=YEiN+/Zp4uE/ISWD@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).