Re: [PATCH] x86: Prefer MWAIT over HALT on AMD processors

From: Borislav Petkov
Date: Tue Apr 05 2022 - 17:39:07 EST

On Tue, Apr 05, 2022 at 06:30:21PM +0530, Wyes Karny wrote:
> From: Lewis Caroll <lewis.carroll@xxxxxxx>
> Currently in the absence of the cpuidle driver (eg: when global
> C-States are disabled in the BIOS or when cpuidle is driver is not
> compiled in),

When does that ever happen?

Sounds like a very very niche situation to me...

> Here we enable MWAIT instruction as the default idle call for AMD
> Zen processors which support MWAIT. We retain the existing behaviour
> for older processors which depend on HALT.

Please use passive voice in your commit message: no "we" or "I", etc,
and describe your changes in imperative mood.

Also, pls read section "2) Describe your changes" in
Documentation/process/submitting-patches.rst for more details.

Also, see section "Changelog" in

Bottom line is: personal pronouns are ambiguous in text, especially with
so many parties/companies/etc developing the kernel so let's avoid them

> static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
> {
> - if (c->x86_vendor != X86_VENDOR_INTEL)
> + if (!early_mwait_supported(c))

Isn't it enough to simply do here:

if (cpu_has(c, X86_FEATURE_ZEN))
return 1;

if (c->x86_vendor != X86_VENDOR_INTEL)
return 0;