linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	tim.c.chen@linux.intel.com, Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH] x86: Don't use MWAIT if explicitly requested
Date: Fri, 18 Oct 2019 09:12:06 +0200	[thread overview]
Message-ID: <20191018071206.GZ2328@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1571370354-17736-1-git-send-email-zhenzhong.duan@oracle.com>

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@oracle.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.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?

  reply	other threads:[~2019-10-18  7:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  3:45 [PATCH] x86: Don't use MWAIT if explicitly requested Zhenzhong Duan
2019-10-18  7:12 ` Peter Zijlstra [this message]
2019-10-18  8:47   ` Zhenzhong Duan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191018071206.GZ2328@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=x86@kernel.org \
    --cc=zhenzhong.duan@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).