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]
Message-ID: <20191018071206.GZ2328@hirez.programming.kicks-ass.net>
Date:   Fri, 18 Oct 2019 09:12:06 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Zhenzhong Duan <zhenzhong.duan@...cle.com>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org,
        tim.c.chen@...ux.intel.com, Thomas Gleixner <tglx@...utronix.de>,
        Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>
Subject: Re: [PATCH] x86: Don't use MWAIT if explicitly requested

On Fri, Oct 18, 2019 at 11:45:54AM +0800, Zhenzhong Duan wrote:
> If 'idle=nomwait' is specified or process matching what's in
> processor_idle_dmi_table, we should't use MWAIT at bootup stage before
> cpuidle driver loaded, even if it's preferred by default on Intel.
> 
> Add a check so that HALT instruction is used in those cases.

The comment in idle_setup():

	/*
	 * If the boot option of "idle=nomwait" is added,
	 * it means that mwait will be disabled for CPU C2/C3
	 * states. In such case it won't touch the variable
	 * of boot_option_idle_override.
	 */
	boot_option_idle_override = IDLE_NOMWAIT;

explicitly states this option is for C2+

> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@...cle.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> ---
>  arch/x86/kernel/process.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index 5e94c43..37fc577 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -667,6 +667,10 @@ static void amd_e400_idle(void)
>   */
>  static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
>  {
> +	/* Don't use MWAIT-C1 if explicitly requested */
> +	if (boot_option_idle_override == IDLE_NOMWAIT)
> +		return 0;

And this is very much about C1...

OTOH, "idle=halt" should be forcing HLT over MWAIT, so did you want to
write:

	if (boot_option_idle_override == IDLE_HALT)
		return 0;

instead?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ