[SRU][Jammy][PATCH 6/7] intel_idle: Fix SPR C6 optimization
Joseph Salisbury
joseph.salisbury at canonical.com
Tue Feb 7 17:58:56 UTC 2023
From: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
BugLink: https://bugs.launchpad.net/bugs/2003267
The Sapphire Rapids (SPR) C6 optimization was added to the end of the
'spr_idle_state_table_update()' function. However, the function has a
'return' which may happen before the optimization has a chance to run.
And this may prevent the optimization from happening.
This is an unlikely scenario, but possible if user boots with, say,
the 'intel_idle.preferred_cstates=6' kernel boot option.
This patch fixes the issue by eliminating the problematic 'return'
statement.
Fixes: 3a9cf77b60dc ("intel_idle: add core C6 optimization for SPR")
Suggested-by: Jan Beulich <jbeulich at suse.com>
Reported-by: Jan Beulich <jbeulich at suse.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
[ rjw: Minor changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
(cherry picked from commit 7eac3bd38d18cd3317756649921b8264ddfee692)
Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
---
drivers/idle/intel_idle.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 7ff47d9f6822..97b3891c500e 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1601,11 +1601,9 @@ static void __init spr_idle_state_table_update(void)
unsigned long long msr;
/* Check if user prefers C1E over C1. */
- if (preferred_states_mask & BIT(2)) {
- if (preferred_states_mask & BIT(1))
- /* Both can't be enabled, stick to the defaults. */
- return;
-
+ if ((preferred_states_mask & BIT(2)) &&
+ !(preferred_states_mask & BIT(1))) {
+ /* Disable C1 and enable C1E. */
spr_cstates[0].flags |= CPUIDLE_FLAG_UNUSABLE;
spr_cstates[1].flags &= ~CPUIDLE_FLAG_UNUSABLE;
--
2.34.1
More information about the kernel-team
mailing list