Re: [PATCH] x86/CPU/AMD: Make sure EFER[AIBRSE] is set

From: Josh Poimboeuf
Date: Sun Feb 26 2023 - 12:27:36 EST


On Sun, Feb 26, 2023 at 12:18:06PM +0100, Borislav Petkov wrote:
> > Right, so rather than spreading all the bug-related MSR logic around,
> > just do it in one spot.
>
> It is all CPU init code and I'm wondering if splitting stuff by vendor
> wouldn't make all that maze in bugs.c a lot more palatable. And get rid
> of
>
> $ git grep VENDOR arch/x86/kernel/cpu/bugs.c | wc -l
> 11
>
> those, for starters.
>
> There's this trade-off of
>
> 1. keeping bugs setup code in one place - but then you need to do vendor
> checks and the other CPU setup code is somewhere else and it is
> probably related, MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT in amd.c for
> example.
>
> or
>
> 2. separating it into their respective files. Then the respective vendor
> code is simple because you don't need vendor checks. It would need to
> be done in a slick way, though, so that it remains maintainable.

At least now it's a (mostly) self-contained hornets nest. I'm not sure
we want to poke it :-)

And I'm not sure spreading the mess around would be an improvement.

--
Josh