[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250211005338.dqj5sg5sj7repdu6@jpoimboe>
Date: Mon, 10 Feb 2025 16:53:38 -0800
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: David Kaplan <david.kaplan@....com>
Cc: Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.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,
"H . Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 13/35] x86/bugs: Restructure spectre_v2_user mitigation
On Wed, Jan 08, 2025 at 02:24:53PM -0600, David Kaplan wrote:
> - if (retbleed_mitigation == RETBLEED_MITIGATION_UNRET ||
> - retbleed_mitigation == RETBLEED_MITIGATION_IBPB) {
> - if (mode != SPECTRE_V2_USER_STRICT &&
> - mode != SPECTRE_V2_USER_STRICT_PREFERRED)
> + if (spectre_v2_user_stibp != SPECTRE_V2_USER_NONE &&
> + (retbleed_mitigation == RETBLEED_MITIGATION_UNRET ||
> + retbleed_mitigation == RETBLEED_MITIGATION_IBPB)) {
This adds a hidden dependency on retbleed_update_mitigation()?
Also, that last line should be aligned one more space to the right:
if (spectre_v2_user_stibp != SPECTRE_V2_USER_NONE &&
(retbleed_mitigation == RETBLEED_MITIGATION_UNRET ||
retbleed_mitigation == RETBLEED_MITIGATION_IBPB)) {
> +static void __init spectre_v2_user_apply_mitigation(void)
> +{
> + /* Initialize Indirect Branch Prediction Barrier */
> + if (boot_cpu_has(X86_FEATURE_IBPB) &&
> + spectre_v2_user_ibpb != SPECTRE_V2_USER_NONE) {
> + setup_force_cpu_cap(X86_FEATURE_USE_IBPB);
>
> -set_mode:
> - pr_info("%s\n", spectre_v2_user_strings[mode]);
> + switch (spectre_v2_user_ibpb) {
> + case SPECTRE_V2_USER_NONE:
> + break;
This case can't happen, spectre_v2_user_ibpb was already checked for
!SPECTRE_V2_USER_NONE above.
--
Josh
Powered by blists - more mailing lists