Messages in this thread Patch in this message | | | From | lirongqing@baidu ... | 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 |
| |
From: Li RongQing <lirongqing@baidu.com>
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 <lirongqing@baidu.com> --- 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/processor.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; enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_NOMWAIT, - IDLE_POLL}; + IDLE_POLL, IDLE_PREF_MWAIT}; 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 = mwait_idle; + boot_option_idle_override = IDLE_PREF_MWAIT; } else if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) { pr_info("using TDX aware idle routine\n"); x86_idle = tdx_safe_halt; -- 2.9.4
| |