Re: [PATCH v2 06/10] x86/mce: Convert multiple if () statements into a switch() statement

From: Sohil Mehta
Date: Thu Oct 24 2024 - 17:32:05 EST


On 10/24/2024 9:42 AM, Luck, Tony wrote:
> - if (c->x86 == 6 && c->x86_model < 0x1A && this_cpu_read(mce_num_banks) > 0)
> + if (c->x86_vfm < INTEL_NEHALEM_EP && this_cpu_read(mce_num_banks) > 0)
> mce_banks[0].init = false;
>
> Updated code now matches for families before 6 (486, Pentium). 486 would never get
> to this code. But I think from the comments about machine check bank 0 being magic
> that Pentium had some rudimentary support.
>

As you mentioned it yourself (the last time I was concerned about family
5), the following check should cover this scenario?

> @@ -1924,6 +1924,10 @@ static void apply_quirks_intel(struct cpuinfo_x86 *c)
> struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array);
> struct mca_config *cfg = &mca_cfg;
>
> + /* Older CPUs (prior to family 6) don't need quirks. */
> + if (c->x86_vfm < INTEL_PENTIUM_PRO)
> + return;
> +


Sohil