Re: [PATCH] x86/cpu/hygon: Prefer HLT over MWAIT for C1 idle when SMT is enabled
From: Borislav Petkov
Date: Sun Sep 27 2026 - 04:01:13 EST
On Thu, Aug 20, 2026 at 09:57:46AM +0800, Mouse Zhang wrote:
> In init_hygon(), set boot_option_idle_override to IDLE_NOMWAIT when no
> explicit idle= option was given and SMT is enabled, so that the default
> C1 idle uses HLT instead of MWAIT. This keeps
> prefer_mwait_c1_over_halt() vendor-neutral while encoding the
> Hygon-specific policy in its own init path.
>
> On Hygon processors with SMT (2 or 4 threads per core) enabled,
> entering C1 with MWAIT causes a significant single-thread performance
> loss compared to HLT when the sibling thread is also in C1. When the
> sibling thread is in C2, it enters that state via IOPORT, which is
> independent of HLT and MWAIT, so performance is unaffected.
>
> Hygon and AMD use different hardware implementations for MWAIT C1, and
> HLT performs better than MWAIT on Hygon platforms when SMT is enabled.
>
> On a Hygon family 18h model 7h system with SMT2 enabled, the
> single-core UnixBench results show HLT outperforming MWAIT by 14.53%,
> and the single-core SPEC CPU 2017 results show improvements of 12.68%
> (intrate) and 19.73% (fprate).
>
> Commit aebef63cf7ff ("x86: Remove vendor checks from
> prefer_mwait_c1_over_halt"), merged in v6.0-rc1, removed the vendor
> check that previously made Hygon use HLT, so Hygon adopted MWAIT and
> hit the performance regression described above. Restore the pre-v6.0
> default to avoid the regression.
>
> Fixes: aebef63cf7ff ("x86: Remove vendor checks from prefer_mwait_c1_over_halt")
> Signed-off-by: Mouse Zhang <zhangzihao@xxxxxxxxxxxx>
> ---
> arch/x86/kernel/cpu/hygon.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
Sashiko has comments:
https://sashiko.dev/#/patchset/20260820015746.1715315-1-zhangzihao%40hieco.com.cn
Please address them: if valid, fix them, if not, explain why they don't need
to be fixed.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette