[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<LV3PR12MB92656DECEFAD6DFA64FBC41F94C02@LV3PR12MB9265.namprd12.prod.outlook.com>
Date: Mon, 24 Feb 2025 15:59:40 +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>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v3 12/35] x86/bugs: Restructure retbleed mitigation
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Borislav Petkov <bp@...en8.de>
> Sent: Monday, February 24, 2025 9:45 AM
> 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>; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH v3 12/35] x86/bugs: Restructure retbleed mitigation
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Wed, Jan 08, 2025 at 02:24:52PM -0600, David Kaplan wrote:
> > +static void __init retbleed_update_mitigation(void) {
> > + if (!boot_cpu_has_bug(X86_BUG_RETBLEED) || cpu_mitigations_off())
> > + return;
> >
> > - break;
> > + if (retbleed_mitigation == RETBLEED_MITIGATION_NONE)
> > + goto out;
> > + /*
> > + * Let IBRS trump all on Intel without affecting the effects of the
> > + * retbleed= cmdline option except for call depth based stuffing
> > + */
> > + if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
> > + switch (spectre_v2_enabled) {
> > + case SPECTRE_V2_IBRS:
> > + retbleed_mitigation = RETBLEED_MITIGATION_IBRS;
> > + break;
> > + case SPECTRE_V2_EIBRS:
> > + case SPECTRE_V2_EIBRS_RETPOLINE:
> > + case SPECTRE_V2_EIBRS_LFENCE:
> > + retbleed_mitigation = RETBLEED_MITIGATION_EIBRS;
> > + break;
> > + default:
> > + if (retbleed_mitigation != RETBLEED_MITIGATION_STUFF)
> > + pr_err(RETBLEED_INTEL_MSG);
> > + }
> > }
> >
> > + if (retbleed_mitigation == RETBLEED_MITIGATION_STUFF) {
> > + if (spectre_v2_enabled != SPECTRE_V2_RETPOLINE) {
> > + pr_err("WARNING: retbleed=stuff depends on
> spectre_v2=retpoline\n");
> > + retbleed_mitigation = RETBLEED_MITIGATION_AUTO;
> > + /* Try again */
> > + retbleed_select_mitigation();
>
> Err, why?
>
> spectre_v2 and spectre_v2_enabled cannot change anymore - the select function
> has set them. Why try again here?
>
> This kinda defeats the whole purpose of having the select -> update -> apply
> rounds...
>
This code is gone from the latest version, I was able to simplify this and it only mattered for some corner cases related to Intel retbleed. Now the update function no longer has to re-call the select function.
--David Kaplan
Powered by blists - more mailing lists