Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] intel_idle: update spec_ctrl register only when necessary
@ 2024-02-06  7:14 Li RongQing
  2024-02-06 17:40 ` Pawan Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Li RongQing @ 2024-02-06  7:14 UTC (permalink / raw)
  To: linux-pm; +Cc: Li RongQing

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-06 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06  7:14 [PATCH] intel_idle: update spec_ctrl register only when necessary Li RongQing
2024-02-06 17:40 ` Pawan Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox