[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <LV3PR12MB92655CEB1AF94875901E700C94C7A@LV3PR12MB9265.namprd12.prod.outlook.com>
Date: Mon, 3 Nov 2025 20:10:39 +0000
From: "Kaplan, David" <David.Kaplan@....com>
To: Borislav Petkov <bp@...en8.de>
CC: Thomas Gleixner <tglx@...utronix.de>, Peter Zijlstra
	<peterz@...radead.org>, Josh Poimboeuf <jpoimboe@...nel.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
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Borislav Petkov <bp@...en8.de>
> Sent: Monday, November 3, 2025 1:32 PM
> To: Kaplan, David <David.Kaplan@....com>
> Cc: Thomas Gleixner <tglx@...utronix.de>; Peter Zijlstra
> <peterz@...radead.org>; Josh Poimboeuf <jpoimboe@...nel.org>; Pawan
> Gupta <pawan.kumar.gupta@...ux.intel.com>; Ingo Molnar
> <mingo@...hat.com>; Dave Hansen <dave.hansen@...ux.intel.com>;
> 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
> Subject: Re: [RFC PATCH 05/56] x86/bugs: Reset spectre_v2 mitigations
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Mon, Oct 13, 2025 at 09:33:53AM -0500, David Kaplan wrote:
> > Add function to reset spectre_v2 mitigations back to their boot-time
> > defaults.
> >
> > Signed-off-by: David Kaplan <david.kaplan@....com>
> > ---
> >  arch/x86/kernel/cpu/bugs.c | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> >
> > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> > index 9d5c6a3e50e1..0430635bb17d 100644
> > --- a/arch/x86/kernel/cpu/bugs.c
> > +++ b/arch/x86/kernel/cpu/bugs.c
> > @@ -2477,6 +2477,24 @@ static void __init
> spectre_v2_apply_mitigation(void)
> >       }
> >  }
> >
> > +#ifdef CONFIG_DYNAMIC_MITIGATIONS
> > +static void spectre_v2_reset_mitigation(void)
>
> Yeah, the reset should definitely be a single function - this ifdeffery around
> every single one is going to become yucky.
>
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.
--David Kaplan
Powered by blists - more mailing lists