Re: [PATCH v2 06/10] x86/mce: Convert multiple if () statements into a switch() statement
From: Sohil Mehta
Date: Mon Oct 21 2024 - 14:26:23 EST
On 10/21/2024 10:51 AM, Luck, Tony wrote:
>> But looking at the prior or the later checks, I see the '<' operator
>> used directly on platform names. So, the new check seems inline with
>> that i.e. in this case, any model or family after the said platform
>> supports MCE broadcasting.
>
> Intel model number allocation policies aren't necessarily sequential.
Model numbers are assumed to be sequential at least within family 6.
if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) &&
cfg->monarch_timeout < 0)
There is another check in early_init_intel() which does this:
if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
> So range checks need to be used with caution. They should be safe
> enough when done to simplify code that checks very old models.
>
...
> Range checks across families may be even more problematic.
I agree. Maybe we should avoid range checks across families altogether
forward (>) or backward (<).
For example, does the following change from Qiuxu, unintentionally
become applicable to Quark CPUs with family -> 5?
> /*
> * There are also broken BIOSes on some Pentium M and
> * earlier systems:
> */
> - if (c->x86 == 6 && c->x86_model <= 13 && cfg->bootlog < 0)
> + if (c->x86_vfm < INTEL_CORE_YONAH && cfg->bootlog < 0)
> cfg->bootlog = 0;