Re: [PATCH v2 2/5] x86/bugs: Use early_param for spectre_v2

From: Borislav Petkov
Date: Fri Aug 22 2025 - 10:39:13 EST


On Fri, Aug 22, 2025 at 02:12:55PM +0000, Kaplan, David wrote:
> It could, but I felt this was a way to logically separate the code vs having
> one giant function. All the code in spectre_v2_check_cmd() does one thing:
> verifies if the chosen command is possible on this system. The rest of
> spectre_v2_select_mitigation() then uses the cmd to actually pick
> a mitigation.
>
> Since these were two distinct flows, I thought having a separate function
> made sense to make the code more readable. But that was just my opinion,
> I won't object if you want to inline it.

Right, since we're making all the mitigations handling uniform, I'd prefer to
have the same code pattern here too. The function does get a bit big but it is
clear that it does two things: (1) checks the command before it (2) selects
the mitigation. And the others do the same so...

Thx.

--
Regards/Gruss,
Boris.

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