From patchwork Fri Dec 2 03:37:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li,Rongqing" X-Patchwork-Id: 28701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp633764wrr; Thu, 1 Dec 2022 20:02:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf7wk0jMP1rxU7EodcD8sby+br/DYZ/CtCpjnbXxoqoGcLaV16Hy7U+XGtlxiJm4Gi3F4ilC X-Received: by 2002:a17:903:3314:b0:189:a208:d13d with SMTP id jk20-20020a170903331400b00189a208d13dmr14694347plb.144.1669953742353; Thu, 01 Dec 2022 20:02:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669953742; cv=none; d=google.com; s=arc-20160816; b=DdpoLlEjKSrd/MWdI/7+Uz6XG6845l3VgDM4JXPOYdU3snz/kTbAaFBryy1cWQnsXh QHQvZlFhSvCicdpdJk0KMfw0KD6QjnS2qtNejb+aSfNc7BQZwAfmF++Lm1VhdJ+kDhNc yME6hqyegUPja7CByGLg875nl8l4E0kTA/5cEZ5n0sXAnB5IB8sC4by8tsoPCezWR+s7 rHzW2QcVzJEHm3SgT628gIfBT8D6Pt6LC9cuZCm7UeFwj6yveh3PnOBuq2Q4GreU+R/Z 4Mo37MFnxQiBhDPGFIgfE3JC05i6ECREyiuufxqQ49ByHF4xRjD9R4EJoeeFG1rWCBEw L3IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from; bh=K3D3PiCRDu5wedC9m7/3OBFGpjWoIobNym58SqS+i2k=; b=WXFG2gF7SjpmAAO5DZjg4IKpE4gWcUw8t1CGPI+5qZZMo7S+M0Cw9K58PgDSFFlTRS Fzk+5TthmPudVK3bZEK3XVwpbFjQRpwgNxzi4LwhLmirzK01nxvZ98NPn3gl5WBWz+WJ veQ7BnkQb2dNltiyCJe1EhAhE0rAS+El13zBSkAI2c4XD+1dks+DrS6CeGORozY/qDyS c6oCixISWCDHkQ1ZSUvp78Wa77D62yjqmRqC6WUd3g6uWjJtl8rB7iICloWaZiQrYrpw Inyt3USVI5L/fiLaTjL3BN20ZSzaYli3uDfc/L7BPP3EjsCfP/eH4q/M5Noi+kyFMa/C NrMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7-20020a634f47000000b00477f41d51f1si6079522pgl.779.2022.12.01.20.02.07; Thu, 01 Dec 2022 20:02:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231562AbiLBD5L (ORCPT + 99 others); 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751073415756292488?= X-GMAIL-MSGID: =?utf-8?q?1751073415756292488?= 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/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;