Skip to content

Commit 7eac3bd

Browse files
dedekindrafaeljw
authored andcommitted
intel_idle: Fix SPR C6 optimization
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: 3a9cf77 ("intel_idle: add core C6 optimization for SPR") Suggested-by: Jan Beulich <[email protected]> Reported-by: Jan Beulich <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> [ rjw: Minor changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 39c184a commit 7eac3bd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/idle/intel_idle.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,11 +1581,9 @@ static void __init spr_idle_state_table_update(void)
15811581
unsigned long long msr;
15821582

15831583
/* Check if user prefers C1E over C1. */
1584-
if (preferred_states_mask & BIT(2)) {
1585-
if (preferred_states_mask & BIT(1))
1586-
/* Both can't be enabled, stick to the defaults. */
1587-
return;
1588-
1584+
if ((preferred_states_mask & BIT(2)) &&
1585+
!(preferred_states_mask & BIT(1))) {
1586+
/* Disable C1 and enable C1E. */
15891587
spr_cstates[0].flags |= CPUIDLE_FLAG_UNUSABLE;
15901588
spr_cstates[1].flags &= ~CPUIDLE_FLAG_UNUSABLE;
15911589

0 commit comments

Comments
 (0)