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

From: Zhuo, Qiuxu
Date: Wed Oct 23 2024 - 03:43:19 EST


> From: Mehta, Sohil <sohil.mehta@xxxxxxxxx>
> [...]
> As Dave mentioned, change this to make the use of vfm consistent in the
> entire function and probably update the comment as well to make it explicit:
>
> /* Older CPUs (prior to family 6) don't need quirks */

Yes, the improved comment is better.

> if (c->x86_vfm < INTEL_PENTIUM_PRO)
> return;
>
> [...]
> > - if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) &&
> > - cfg->monarch_timeout < 0)
> > + if (c->x86_vfm >= INTEL_CORE_YONAH && cfg->monarch_timeout <
> > + 0)
> > cfg->monarch_timeout = USEC_PER_SEC;
> >
>
> Instead of keeping this open-ended we could tweak this a bit as follows:
>
> if (!(c->x86_vfm < INTEL_CORE_YONAH)) && cfg->monarch_timeout < 0)
> cfg->monarch_timeout = USEC_PER_SEC;
>
> Essentially the same: if (new_cpu) vs if (!old_cpu) Don't have a strong
> preference. Will leave it to you and Tony.
>

I prefer the single, straightforward '>=' operation over the '<' and then '!' two operations.

- Qiuxu