Skip to content

Commit

Permalink
intel_idle: replace conditionals with static_cpu_has(X86_FEATURE_ARAT)
Browse files Browse the repository at this point in the history
If the 'arat' cpu flag is set, then the conditionals in intel_idle() that
guard calling tick_broadcast_enter()/exit() will never be true. Use
static_cpu_has(X86_FEATURE_ARAT) to create a fast path to replace
the conditional.

Signed-off-by: Jason Baron <jbaron@akamai.com>
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
almostivan authored and rafaeljw committed Oct 11, 2017
1 parent f187851 commit 0563bb7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions drivers/idle/intel_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,7 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
struct cpuidle_state *state = &drv->states[index];
unsigned long eax = flg2MWAIT(state->flags);
unsigned int cstate;

cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
bool uninitialized_var(tick);

/*
* NB: if CPUIDLE_FLAG_TLB_FLUSHED is set, this idle transition
Expand All @@ -923,12 +922,19 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
* useful with this knowledge.
*/

if (!(lapic_timer_reliable_states & (1 << (cstate))))
tick_broadcast_enter();
if (!static_cpu_has(X86_FEATURE_ARAT)) {
cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) &
MWAIT_CSTATE_MASK) + 1;
tick = false;
if (!(lapic_timer_reliable_states & (1 << (cstate)))) {
tick = true;
tick_broadcast_enter();
}
}

mwait_idle_with_hints(eax, ecx);

if (!(lapic_timer_reliable_states & (1 << (cstate))))
if (!static_cpu_has(X86_FEATURE_ARAT) && tick)
tick_broadcast_exit();

return index;
Expand Down

0 comments on commit 0563bb7

Please sign in to comment.