Re: [PATCH 3/5] x86/cpu: Replace PEBS use of 'x86_cpu_desc' use with 'x86_cpu_id'

From: Pawan Gupta
Date: Fri Dec 06 2024 - 18:58:31 EST


On Fri, Dec 06, 2024 at 11:38:34AM -0800, Dave Hansen wrote:
> diff -puN arch/x86/events/intel/core.c~zap-x86_cpu_desc arch/x86/events/intel/core.c
> --- a/arch/x86/events/intel/core.c~zap-x86_cpu_desc 2024-12-06 11:33:16.775171950 -0800
> +++ b/arch/x86/events/intel/core.c 2024-12-06 11:33:16.779172107 -0800
> @@ -5371,42 +5371,33 @@ static __init void intel_clovertown_quir
> x86_pmu.pebs_constraints = NULL;
> }
>
> -static const struct x86_cpu_desc isolation_ucodes[] = {
> - INTEL_CPU_DESC(INTEL_HASWELL, 3, 0x0000001f),
> - INTEL_CPU_DESC(INTEL_HASWELL_L, 1, 0x0000001e),
> - INTEL_CPU_DESC(INTEL_HASWELL_G, 1, 0x00000015),
> - INTEL_CPU_DESC(INTEL_HASWELL_X, 2, 0x00000037),
> - INTEL_CPU_DESC(INTEL_HASWELL_X, 4, 0x0000000a),
> - INTEL_CPU_DESC(INTEL_BROADWELL, 4, 0x00000023),
> - INTEL_CPU_DESC(INTEL_BROADWELL_G, 1, 0x00000014),
> - INTEL_CPU_DESC(INTEL_BROADWELL_D, 2, 0x00000010),
> - INTEL_CPU_DESC(INTEL_BROADWELL_D, 3, 0x07000009),
> - INTEL_CPU_DESC(INTEL_BROADWELL_D, 4, 0x0f000009),
> - INTEL_CPU_DESC(INTEL_BROADWELL_D, 5, 0x0e000002),
> - INTEL_CPU_DESC(INTEL_BROADWELL_X, 1, 0x0b000014),
> - INTEL_CPU_DESC(INTEL_SKYLAKE_X, 3, 0x00000021),
> - INTEL_CPU_DESC(INTEL_SKYLAKE_X, 4, 0x00000000),
> - INTEL_CPU_DESC(INTEL_SKYLAKE_X, 5, 0x00000000),
> - INTEL_CPU_DESC(INTEL_SKYLAKE_X, 6, 0x00000000),
> - INTEL_CPU_DESC(INTEL_SKYLAKE_X, 7, 0x00000000),
> - INTEL_CPU_DESC(INTEL_SKYLAKE_X, 11, 0x00000000),
> - INTEL_CPU_DESC(INTEL_SKYLAKE_L, 3, 0x0000007c),
> - INTEL_CPU_DESC(INTEL_SKYLAKE, 3, 0x0000007c),
> - INTEL_CPU_DESC(INTEL_KABYLAKE, 9, 0x0000004e),
> - INTEL_CPU_DESC(INTEL_KABYLAKE_L, 9, 0x0000004e),
> - INTEL_CPU_DESC(INTEL_KABYLAKE_L, 10, 0x0000004e),
> - INTEL_CPU_DESC(INTEL_KABYLAKE_L, 11, 0x0000004e),
> - INTEL_CPU_DESC(INTEL_KABYLAKE_L, 12, 0x0000004e),
> - INTEL_CPU_DESC(INTEL_KABYLAKE, 10, 0x0000004e),
> - INTEL_CPU_DESC(INTEL_KABYLAKE, 11, 0x0000004e),
> - INTEL_CPU_DESC(INTEL_KABYLAKE, 12, 0x0000004e),
> - INTEL_CPU_DESC(INTEL_KABYLAKE, 13, 0x0000004e),
> +static const struct x86_cpu_id isolation_ucodes[] = {
> + X86_MATCH_VFM_STEPPINGS(INTEL_HASWELL, 3, 3, 0x0000001f),
> + X86_MATCH_VFM_STEPPINGS(INTEL_HASWELL_L, 1, 1, 0x0000001e),
> + X86_MATCH_VFM_STEPPINGS(INTEL_HASWELL_G, 1, 1, 0x00000015),
> + X86_MATCH_VFM_STEPPINGS(INTEL_HASWELL_X, 2, 2, 0x00000037),
> + X86_MATCH_VFM_STEPPINGS(INTEL_HASWELL_X, 4, 4, 0x0000000a),
> + X86_MATCH_VFM_STEPPINGS(INTEL_BROADWELL, 4, 4, 0x00000023),
> + X86_MATCH_VFM_STEPPINGS(INTEL_BROADWELL_G, 1, 1, 0x00000014),
> + X86_MATCH_VFM_STEPPINGS(INTEL_BROADWELL_D, 2, 2, 0x00000010),
> + X86_MATCH_VFM_STEPPINGS(INTEL_BROADWELL_D, 3, 3, 0x07000009),
> + X86_MATCH_VFM_STEPPINGS(INTEL_BROADWELL_D, 4, 4, 0x0f000009),
> + X86_MATCH_VFM_STEPPINGS(INTEL_BROADWELL_D, 5, 5, 0x0e000002),
> + X86_MATCH_VFM_STEPPINGS(INTEL_BROADWELL_X, 1, 1, 0x0b000014),
> + X86_MATCH_VFM_STEPPINGS(INTEL_SKYLAKE_X, 3, 3, 0x00000021),
> + X86_MATCH_VFM_STEPPINGS(INTEL_SKYLAKE_X, 4, 7, 0x00000000),
> + X86_MATCH_VFM_STEPPINGS(INTEL_SKYLAKE_X, 11, 11, 0x00000000),
> + X86_MATCH_VFM_STEPPINGS(INTEL_SKYLAKE_L, 3, 3, 0x0000007c),
> + X86_MATCH_VFM_STEPPINGS(INTEL_SKYLAKE, 3, 3, 0x0000007c),
> + X86_MATCH_VFM_STEPPINGS(INTEL_KABYLAKE, 9, 9, 0x0000004e),

This ...

> + X86_MATCH_VFM_STEPPINGS(INTEL_KABYLAKE_L, 9, 12, 0x0000004e),
> + X86_MATCH_VFM_STEPPINGS(INTEL_KABYLAKE, 10, 13, 0x0000004e),

... and this can also be combined into a single entry.