Skip to content

Commit

Permalink
intel_idle: Fix SPR C6 optimization
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dedekind authored and rafaeljw committed Apr 27, 2022
1 parent 39c184a commit 7eac3bd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/idle/intel_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,11 +1581,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;

Expand Down

0 comments on commit 7eac3bd

Please sign in to comment.