2022-02-22 16:20:41

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH] x86/mce: Simplify CPU vendor checks for AMD/Hygon and Intel/Zhaoxin

On Tue, Feb 22, 2022 at 09:58:58AM -0600, Carlos Bilbao wrote:
> In a number of places across the MCE subsystem we check if we are running
> an x86 processor from AMD/Hygon or Intel/Zhaoxin vendors. Simplify these
> checks with two mce_flags updated at CPU MCE initialization.

... and what's the point of this silliness?

Btw, you don't have to send it to my *two* email addresses - one is
enough. :)

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette


2022-02-22 18:10:06

by Bilbao, Carlos

[permalink] [raw]
Subject: Re: [PATCH] x86/mce: Simplify CPU vendor checks for AMD/Hygon and Intel/Zhaoxin

Hello,

On 2/22/2022 10:10 AM, Borislav Petkov wrote:
> On Tue, Feb 22, 2022 at 09:58:58AM -0600, Carlos Bilbao wrote:
>> In a number of places across the MCE subsystem we check if we are running
>> an x86 processor from AMD/Hygon or Intel/Zhaoxin vendors. Simplify these
>> checks with two mce_flags updated at CPU MCE initialization.
>
> ... and what's the point of this silliness?
>

the point is to simplify the code (as the patch stated). Since we have 57
bits reserved but unused, it also wouldn't cost anything.

> Btw, you don't have to send it to my *two* email addresses - one is
> enough. :)
>

Noted.

Carlos.

2022-02-22 18:28:00

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH] x86/mce: Simplify CPU vendor checks for AMD/Hygon and Intel/Zhaoxin

Hi,

On Tue, Feb 22, 2022 at 10:42:25AM -0600, Carlos Bilbao wrote:
> the point is to simplify the code (as the patch stated).

But it doesn't simplify the code - it makes it obscure.

Also, your "simplification" breaks the moment you need to do something
for the one vendor but *not* for the other.

Because in such cases you'll have to do

if (mce_flags.amd_compatible && m->cpuvendor != X86_VENDOR_HYGON)

which makes me go, "huh what?!"

So no, that's not better.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette