Re: [PATCH 3/3] x86, cpu: Change NOP selection for certain IntelCPUs

From: Steven Rostedt
Date: Mon Apr 18 2011 - 19:34:40 EST


On Mon, 2011-04-18 at 15:36 -0700, H. Peter Anvin wrote:
> Due to a decoder implementation quirk, some specific Intel CPUs
> actually perform better with the "k8_nops" than with the
> SDM-recommended NOPs. For runtime-selected NOPs, if we detect those
> specific CPUs then use the k8_nops instead of the ones we would
> normally use.
>
> Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> Cc: Jason Baron <jbaron@xxxxxxxxxx>
> ---
> arch/x86/kernel/alternative.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 2ca3f65..34bf87e 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -190,7 +190,14 @@ void __init arch_init_ideal_nops(void)
> {
> switch (boot_cpu_data.x86_vendor) {
> case X86_VENDOR_INTEL:

Please add:

/*
* Due to a decoder implementation quirk, some specific Intel CPUs
* actually perform better with the "k8_nops" than with the
* SDM-recommended NOPs. For runtime-selected NOPs, if we detect those
* specific CPUs then use the k8_nops instead of the ones we would
* normally use.
*/

I tend to read comments by the code more than change logs that added the
code.

Thanks,

-- Steve

> - if (boot_cpu_has(X86_FEATURE_NOPL)) {
> + 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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/