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

From: Wen Pu
Date: Wed Apr 06 2022 - 22:40:14 EST



On 2022/4/5 22:07, Peter Zijlstra wrote:
> On Tue, Apr 05, 2022 at 06:30:21PM +0530, Wyes Karny wrote:
>> +static inline bool early_mwait_supported(const struct cpuinfo_x86 *c)
>> +{
>> + if (c->x86_vendor == X86_VENDOR_INTEL)
>> + return true;
>> +
>> + if (c->x86_vendor == X86_VENDOR_AMD && cpu_has(c, X86_FEATURE_ZEN))
>
> What about Hygon? For some reason you guys don't co-ordinate and we end
> up getting endless 'make-same' patches, sometimes separated by years :/


Hygon CPU supports MWAIT, so this patch also make sense for Hygon :)
As Dave Hansen and Lewis Caroll mentioned in the following threads,
Hygon has already set the X86_FEATURE_ZEN flag, so it's better to
use X86_FEATURE_ZEN for all Zen uarch CPUs.

>> + return true;
>> +
>> + return false;
>> +}

--
Regards,
Pu Wen