From nobody Thu Sep 18 20:29:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEB42C4332F for ; Fri, 2 Dec 2022 03:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbiLBD5L (ORCPT ); Thu, 1 Dec 2022 22:57:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230382AbiLBD5J (ORCPT ); Thu, 1 Dec 2022 22:57:09 -0500 X-Greylist: delayed 600 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 01 Dec 2022 19:57:06 PST Received: from mx417.baidu.com (mx417.baidu.com [124.64.200.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 42113CFE63 for ; Thu, 1 Dec 2022 19:57:06 -0800 (PST) Received: from bjhw-sys-rpm015653cc5.bjhw.baidu.com (bjhw-sys-rpm015653cc5.bjhw.baidu.com [10.227.53.39]) by mx417.baidu.com (Postfix) with ESMTP id 99CED19B80054; Fri, 2 Dec 2022 11:37:32 +0800 (CST) Received: from localhost (localhost [127.0.0.1]) by bjhw-sys-rpm015653cc5.bjhw.baidu.com (Postfix) with ESMTP id 940AED9932; Fri, 2 Dec 2022 11:37:32 +0800 (CST) From: lirongqing@baidu.com To: tglx@linutronix.de, 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: [PATCH][RFC] x86: override prefer_mwait_c1_over_halt to avoid loading cpuidle-haltpoll driver Date: Fri, 2 Dec 2022 11:37:32 +0800 Message-Id: <1669952252-32710-1-git-send-email-lirongqing@baidu.com> X-Mailer: git-send-email 1.7.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Li RongQing 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 Signed-off-by: Li RongQing --- arch/x86/include/asm/processor.h | 2 +- arch/x86/kernel/process.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/proces= sor.h index 67c9d73..6bc94fd 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -658,7 +658,7 @@ extern void amd_e400_c1e_apic_setup(void); extern unsigned long boot_option_idle_override; =20 enum idle_boot_override {IDLE_NO_OVERRIDE=3D0, IDLE_HALT, IDLE_NOMWAIT, - IDLE_POLL}; + IDLE_POLL, IDLE_PREF_MWAIT}; =20 extern void enable_sep_cpu(void); extern int sysenter_setup(void); diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index c21b734..a16985c 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -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 =3D mwait_idle; + boot_option_idle_override =3D IDLE_PREF_MWAIT; } else if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) { pr_info("using TDX aware idle routine\n"); x86_idle =3D tdx_safe_halt; --=20 2.9.4