From: Li RongQing <lirongqing@baidu.com>
To: linux-pm@vger.kernel.org
Cc: Li RongQing <lirongqing@baidu.com>
Subject: [PATCH] intel_idle: update spec_ctrl register only when necessary
Date: Tue, 6 Feb 2024 15:14:52 +0800 [thread overview]
Message-ID: <20240206071452.42673-1-lirongqing@baidu.com> (raw)
spec_ctrl maybe 0 when mitigations is off, and writing spec_ctrl MSR
is expensive operation, so update spec_ctrl only when necessary
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
drivers/idle/intel_idle.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index bcf1198..8150d5f 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -176,12 +176,12 @@ static __cpuidle int intel_idle_ibrs(struct cpuidle_device *dev,
u64 spec_ctrl = spec_ctrl_current();
int ret;
- if (smt_active)
+ if (smt_active && spec_ctrl)
__update_spec_ctrl(0);
ret = __intel_idle(dev, drv, index, true);
- if (smt_active)
+ if (smt_active && spec_ctrl)
__update_spec_ctrl(spec_ctrl);
return ret;
--
2.9.4
next reply other threads:[~2024-02-06 7:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 7:14 Li RongQing [this message]
2024-02-06 17:40 ` [PATCH] intel_idle: update spec_ctrl register only when necessary Pawan Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240206071452.42673-1-lirongqing@baidu.com \
--to=lirongqing@baidu.com \
--cc=linux-pm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox