summaryrefslogtreecommitdiff
path: root/drivers/idle/intel_idle.c
diff options
context:
space:
mode:
authorJason Baron <jbaron@akamai.com>2017-10-06 20:19:45 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-10-11 03:02:16 +0300
commit0563bb7ba67eec7a87a9ccc04b80bb59de26c319 (patch)
treedd90a616853afceca5532c2359a683a25206f38d /drivers/idle/intel_idle.c
parentf187851b9b4a76952b1158b86434563dd2031103 (diff)
downloadlinux-0563bb7ba67eec7a87a9ccc04b80bb59de26c319.tar.xz
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: 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>
Diffstat (limited to 'drivers/idle/intel_idle.c')
-rw-r--r--drivers/idle/intel_idle.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 5dc7ea4b6bc4..5db5e3176f6a 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -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
@@ -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;