From: Thomas Gleixner <tglx@linutronix.de>
To: lirongqing@baidu.com, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org,
peterz@infradead.org, tony.luck@intel.com, wyes.karny@amd.com,
linux-kernel@vger.kernel.org, rafael.j.wysocki@intel.com
Subject: Re: [PATCH][RFC] x86: override prefer_mwait_c1_over_halt to avoid loading cpuidle-haltpoll driver
Date: Fri, 02 Dec 2022 19:48:16 +0100 [thread overview]
Message-ID: <87fsdxprpr.ffs@tglx> (raw)
In-Reply-To: <1669952252-32710-1-git-send-email-lirongqing@baidu.com>
Li!
On Fri, Dec 02 2022 at 11:37, lirongqing@baidu.com wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> x86 KVM guests with MWAIT can load cpuidle-haltpoll driver, and will
> cause performance degradation, so override prefer_mwait_c1_over_halt
> to a new value, aviod loading cpuidle-haltpoll driver
Neither the subject line nor the above makes any sense to me.
prefer_mwait_c1_over_halt() is a function which is invoked and when it
returns true then the execution ends up in the code path you are
patching.
> @@ -889,6 +889,7 @@ void select_idle_routine(const struct cpuinfo_x86 *c)
> } else if (prefer_mwait_c1_over_halt(c)) {
> pr_info("using mwait in idle threads\n");
> x86_idle = mwait_idle;
> + boot_option_idle_override = IDLE_PREF_MWAIT;
What you do is setting boot_option_idle_override to a new value, but
that has nothing to do with prefer_mwait_c1_over_halt() at all.
So how are you overriding that function to a new value?
But that's just a word smithing problem.
The real and way worse problem is that you pick a variable, which has
the purpose to capture the idle override on the kernel command line, and
modify it as you see fit, just to prevent that driver from loading.
select_idle_routine() reads it to check whether there was a command line
override or not. But it is not supposed to write it. Why?
Have you checked what else evaluates that variable? Obviously not,
because a simple grep would have told you:
drivers/cpuidle/cpuidle-haltpoll.c: if (boot_option_idle_override != IDLE_NO_OVERRIDE)
drivers/idle/intel_idle.c: if (boot_option_idle_override != IDLE_NO_OVERRIDE)
Congratulations!
Your patch breaks the default setup of every recent Intel system on the
planet because it not only prevents the cpuidle-haltpoll, but also the
intel_idle driver from loading.
Seriously. It's not too much asked to do at least a simple grep and look
at all _nine_ places which evaluate boot_option_idle_override.
Thanks,
tglx
next prev parent reply other threads:[~2022-12-02 18:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 3:37 [PATCH][RFC] x86: override prefer_mwait_c1_over_halt to avoid loading cpuidle-haltpoll driver lirongqing
2022-12-02 18:48 ` Thomas Gleixner [this message]
2022-12-04 11:31 ` Li,Rongqing
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=87fsdxprpr.ffs@tglx \
--to=tglx@linutronix.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=tony.luck@intel.com \
--cc=wyes.karny@amd.com \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.