[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <j2mds5vdblnhpha6oyejqcj2fgmveylgaudzzljvfwwl3fgvnw@xgmsl4f7jzv4>
Date: Tue, 4 Nov 2025 18:29:20 -0800
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Borislav Petkov <bp@...en8.de>
Cc: "Kaplan, David" <David.Kaplan@....com>,
Thomas Gleixner <tglx@...utronix.de>, Peter Zijlstra <peterz@...radead.org>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>, Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, "x86@...nel.org" <x86@...nel.org>,
"H . Peter Anvin" <hpa@...or.com>, Alexander Graf <graf@...zon.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 05/56] x86/bugs: Reset spectre_v2 mitigations
On Mon, Nov 03, 2025 at 09:28:11PM +0100, Borislav Petkov wrote:
> On Mon, Nov 03, 2025 at 08:10:39PM +0000, Kaplan, David wrote:
> > Do you really want it all in one big function? Or just to relocate all the
> > *_reset_mitigation() functions to a single place so they can all go under
> > one ifdef?
> >
> > I can do it in one big function, but it'd probably look something like:
> >
> > /* Reset spectre_v1 */
> > setup_clear_cpu_cap(X86_FEATURE_FENCE_SWAPGS_USER);
> > setup_clear_cpu_cap(X86_FEATURE_FENCE_SWAPGS_KERNEL);
> > spectre_v1_mitigation = SPECTRE_V1_MITIGATION_AUTO;
> > /* Reset mds */
> > setup_clear_cpu_cap(X86_FEATURE_CLEAR_CPU_BUF);
> > static_branch_disable(&cpu_buf_idle_clear);
> > mds_mitigation = IS_ENABLED(CONFIG_MITIGATION_MDS) ?
> > MDS_MITIGATION_AUTO : MDS_MITIGATION_OFF;
> > /* Reset spectre_v2 */
> > Etc.
>
> Yap, that's what I thought too.
>
> Since there's no point to have separate functions, the comment separation is
> perfectly sufficient, I'd say.
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.
--
Josh
Powered by blists - more mailing lists