[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0a4f1738-dd0e-efdb-b137-7a7c9875786d@redhat.com>
Date: Mon, 3 Jul 2023 11:09:12 -0400
From: Waiman Long <longman@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Len Brown <lenb@...nel.org>, Jonathan Corbet <corbet@....net>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
x86@...nel.org, linux-pm@...r.kernel.org,
Robin Jarry <rjarry@...hat.com>, Joe Mario <jmario@...hat.com>
Subject: Re: [PATCH v4 4/4] intel_idle: Add ibrs_off module parameter to force
disable IBRS
On 7/3/23 06:32, Peter Zijlstra wrote:
> On Tue, Jun 27, 2023 at 10:25:54PM -0400, Waiman Long wrote:
>
>> @@ -69,6 +69,7 @@ static int max_cstate = CPUIDLE_STATE_MAX - 1;
>> static unsigned int disabled_states_mask __read_mostly;
>> static unsigned int preferred_states_mask __read_mostly;
>> static bool force_irq_on __read_mostly;
>> +static bool ibrs_off __read_mostly;
>>
>> static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
>>
>> @@ -1919,12 +1920,15 @@ static void state_update_enter_method(struct cpuidle_state *state, int cstate)
>> }
>>
>> if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) &&
>> - state->flags & CPUIDLE_FLAG_IBRS) {
>> + ((state->flags & CPUIDLE_FLAG_IBRS) || ibrs_off)) {
>> /*
>> * IBRS mitigation requires that C-states are entered
>> * with interrupts disabled.
>> */
>> - WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
>> + if (ibrs_off && (state->flags & CPUIDLE_FLAG_IRQ_ENABLE))
>> + state->flags &= ~CPUIDLE_FLAG_IRQ_ENABLE;
>> + else
>> + WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
> If you're respinning this, you can leave out the else and avoid the
> indent on the WARN:
>
> + if (ibrs_off && (state->flags & CPUIDLE_FLAG_IRQ_ENABLE))
> + state->flags &= ~CPUIDLE_FLAG_IRQ_ENABLE;
> WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
>
> Same effect, simpler code and all that.
That is true. I can certainly respin that as there is another suggested
doc change that is pending.
Cheers,
Longman
Powered by blists - more mailing lists