Messages in this thread | | | Date | Wed, 6 Apr 2022 11:44:52 +0530 | Subject | Re: [PATCH] x86: Prefer MWAIT over HALT on AMD processors | From | Wyes Karny <> |
| |
On 4/5/2022 7:35 PM, Borislav Petkov wrote: > On Tue, Apr 05, 2022 at 06:30:21PM +0530, Wyes Karny wrote: >> From: Lewis Caroll <lewis.carroll@amd.com> >> >> 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... Certain customers prefer to turn off C-States from the BIOS in low-latency environments.
> >> 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 > Documentation/process/maintainer-tip.rst > > Bottom line is: personal pronouns are ambiguous in text, especially with > so many parties/companies/etc developing the kernel so let's avoid them > please.
Sure. I'll update this. Thanks. > >> 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; > > ... > >
If x86_FEATURE_ZEN is set and X86_FEATURE_MWAIT is not set or has X86_BUG_MONITOR then it won't return correct value.
-- Thanks, Wyes
| |