mirror of https://lore.kernel.org/lkml/
 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 11:22:48 +0100	[thread overview]
Message-ID: <YEid+HQnqgnt3iyY@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YEiZXtB74cnsLTx/@hirez.programming.kicks-ass.net>

On Wed, Mar 10, 2021 at 11:03:10AM +0100, Peter Zijlstra wrote:
> -void __init arch_init_ideal_nops(void)
> -{
> -	switch (boot_cpu_data.x86_vendor) {
> -	case X86_VENDOR_INTEL:
> -		/*
> -		 * Due to a decoder implementation quirk, some
> -		 * specific Intel CPUs actually perform better with
> -		 * the "k8_nops" than with the SDM-recommended NOPs.
> -		 */
> -		if (boot_cpu_data.x86 == 6 &&
> -		    boot_cpu_data.x86_model >= 0x0f &&
> -		    boot_cpu_data.x86_model != 0x1c &&
> -		    boot_cpu_data.x86_model != 0x26 &&
> -		    boot_cpu_data.x86_model != 0x27 &&
> -		    boot_cpu_data.x86_model < 0x30) {
> -			ideal_nops = k8_nops;
> -		} else if (boot_cpu_has(X86_FEATURE_NOPL)) {
> -			   ideal_nops = p6_nops;
> -		} else {
> -#ifdef CONFIG_X86_64
> -			ideal_nops = k8_nops;
> -#else
> -			ideal_nops = intel_nops;
> -#endif
> -		}
> -		break;
> -
> -	case X86_VENDOR_HYGON:
> -		ideal_nops = p6_nops;
> -		return;
> -
> -	case X86_VENDOR_AMD:
> -		if (boot_cpu_data.x86 > 0xf) {
> -			ideal_nops = p6_nops;
> -			return;
> -		}
> -
> -		fallthrough;
> -
> -	default:
> -#ifdef CONFIG_X86_64
> -		ideal_nops = k8_nops;
> -#else
> -		if (boot_cpu_has(X86_FEATURE_K8))
> -			ideal_nops = k8_nops;
> -		else if (boot_cpu_has(X86_FEATURE_K7))
> -			ideal_nops = k7_nops;
> -		else
> -			ideal_nops = intel_nops;
> -#endif
> -	}
> -}

After this FEATURE_NOPL is unused except for required-features for
x86_64. FEATURE_K8 is only used for PTI and FEATURE_K7 is unused.

AFAICT this negatively affects lots of 32bit (DONTCARE) and 32bit on
64bit CPUs (CARELESS) and early AMD (K8) which is from 2003 and almost
2 decades old by now (SHRUG).

Everything x86_64 since AMD K10 (2007) was using p6_nops.

And per FEATURE_NOPL being required for x86_64, all those CPUs can use
p6_nops. So stop caring about NOPs, simplify things and get on with life
:-)

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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 16:58 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
2021-03-10  9:35         ` Peter Zijlstra
2021-03-10 10:03           ` Peter Zijlstra
2021-03-10 10:22             ` Peter Zijlstra [this message]
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=YEid+HQnqgnt3iyY@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

all inboxes | Powered by JetHome®