Re: [RFC PATCH 05/56] x86/bugs: Reset spectre_v2 mitigations
From: Josh Poimboeuf
Date: Wed Nov 05 2025 - 12:06:40 EST
On Wed, Nov 05, 2025 at 12:03:18PM +0100, Borislav Petkov wrote:
> On Tue, Nov 04, 2025 at 06:29:20PM -0800, Josh Poimboeuf wrote:
> > Separate functions allows each reset function to stay close to its
> > select/update/apply counterparts. That makes it easier to tell that
> > it's undoing all the right things. Plus it preserves the existing
> > logical code layout/separation between mitigations.
>
> ... with a forward declaration for each one?
Nope, these patches don't add any forward declarations because they
sanely put the caller below the callees.
We should put cpu_select_mitigations() at the bottom too, then all those
existing forward declarations can go away.
> Because we don't have enough functions in this file already?
I don't see how the solution to "too many functions" is to start
squirreling away some arbitrary parts of (otherwise logically separated)
code in a hidden uber-function away from the rest?
> And even if the code structure is begging for
> us to turn it a OOO design, we're not doing it?
If "functions bad" then why not make cpu_select_mitigations() one big
happy function with a ton of comments? Just think of all the function
savings ;-)
--
Josh