lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Jun 2023 09:30:56 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Waiman Long <longman@...hat.com>
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>, linux-kernel@...r.kernel.org,
        x86@...nel.org, linux-pm@...r.kernel.org,
        Robin Jarry <rjarry@...hat.com>, Joe Mario <jmario@...hat.com>
Subject: Re: [PATCH v2 4/5] intel_idle: Add no_ibrs module parameter to force
 disable IBRS

On Tue, Jun 20, 2023 at 10:06:24AM -0400, Waiman Long wrote:
> Commit bf5835bcdb96 ("intel_idle: Disable IBRS during long idle")
> disables IBRS when the cstate is 6 or lower. However, there are
> some use cases where a customer may want to use max_cstate=1 to
> lower latency. 

And then add the WRMSRs to increase latency again...

Since you're mucking about with all this, perhaps see if you can measure
the latency impact of all this.

> Such use cases will suffer from the performance
> degradation caused by the enabling of IBRS in the sibling idle thread.
> Add a "no_ibrs" module parameter to force disable IBRS and the
> CPUIDLE_FLAG_IRQ_ENABLE flag if set.
> 
> In the case of a Skylake server with max_cstate=1, this new no_ibrs
> option will increase the IRQ response latency as IRQ will now be
> disabled.
> 
> Signed-off-by: Waiman Long <longman@...hat.com>
> ---
>  drivers/idle/intel_idle.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index 07fa23707b3c..366dacccc971 100644
> --- a/drivers/idle/intel_idle.c
> +++ b/drivers/idle/intel_idle.c
> @@ -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 no_ibrs __read_mostly;
>  
>  static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
>  
> @@ -1907,12 +1908,15 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
>  			WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
>  			state->enter = intel_idle_xstate;
>  		} else if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) &&
> -			   state->flags & CPUIDLE_FLAG_IBRS) {
> +			  ((state->flags & CPUIDLE_FLAG_IBRS) || no_ibrs)) {
>  			/*
>  			 * IBRS mitigation requires that C-states are entered
>  			 * with interrupts disabled.
>  			 */
> -			WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
> +			if (no_ibrs && (state->flags & CPUIDLE_FLAG_IRQ_ENABLE))
> +				state->flags &= ~CPUIDLE_FLAG_IRQ_ENABLE;
> +			else
> +				WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
>  			state->enter = intel_idle_ibrs;
>  		} else if (state->flags & CPUIDLE_FLAG_IRQ_ENABLE) {
>  			state->enter = intel_idle_irq;
> @@ -2165,3 +2169,9 @@ MODULE_PARM_DESC(preferred_cstates, "Mask of preferred idle states");
>   * 'CPUIDLE_FLAG_INIT_XSTATE' and 'CPUIDLE_FLAG_IBRS' flags.
>   */
>  module_param(force_irq_on, bool, 0444);
> +/*
> + * Force the disabling of IBRS when X86_FEATURE_KERNEL_IBRS is on and
> + * CPUIDLE_FLAG_IRQ_ENABLE isn't set.
> + */
> +module_param(no_ibrs, bool, 0444);
> +MODULE_PARM_DESC(no_ibrs, "Disable IBRS when idle");

Urgghhh.. the flag is CPUIDLE_FLAG_IBRS, so "no_ibrs" implies clearing
that flag.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ