Commit 0563bb7b authored by Jason Baron's avatar Jason Baron Committed by Rafael J. Wysocki

intel_idle: replace conditionals with static_cpu_has(X86_FEATURE_ARAT)

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: default avatarJason Baron <jbaron@akamai.com>
Acked-by: default avatarJacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent f187851b
...@@ -913,8 +913,7 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev, ...@@ -913,8 +913,7 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
struct cpuidle_state *state = &drv->states[index]; struct cpuidle_state *state = &drv->states[index];
unsigned long eax = flg2MWAIT(state->flags); unsigned long eax = flg2MWAIT(state->flags);
unsigned int cstate; unsigned int cstate;
bool uninitialized_var(tick);
cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
/* /*
* NB: if CPUIDLE_FLAG_TLB_FLUSHED is set, this idle transition * NB: if CPUIDLE_FLAG_TLB_FLUSHED is set, this idle transition
...@@ -923,12 +922,19 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev, ...@@ -923,12 +922,19 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
* useful with this knowledge. * useful with this knowledge.
*/ */
if (!(lapic_timer_reliable_states & (1 << (cstate)))) if (!static_cpu_has(X86_FEATURE_ARAT)) {
tick_broadcast_enter(); 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); mwait_idle_with_hints(eax, ecx);
if (!(lapic_timer_reliable_states & (1 << (cstate)))) if (!static_cpu_has(X86_FEATURE_ARAT) && tick)
tick_broadcast_exit(); tick_broadcast_exit();
return index; return index;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment