aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2013-12-12 09:08:36 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2013-12-19 14:54:44 -0500
commit16824255394f55adf31b9a96a9965d8c15bdac4c (patch)
treeb28f4a2d59db25700c8b4eafb2e3cfc188c121bc /drivers
parent40e2d7f9b5dae048789c64672bf3027fbb663ffa (diff)
x86, acpi, idle: Restructure the mwait idle routines
People seem to delight in writing wrong and broken mwait idle routines; collapse the lot. This leaves mwait_play_dead() the sole remaining user of __mwait() and new __mwait() users are probably doing it wrong. Also remove __sti_mwait() as its unused. Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Jacob Jun Pan <jacob.jun.pan@linux.intel.com> Cc: Mike Galbraith <bitbucket@online.de> Cc: Len Brown <lenb@kernel.org> Cc: Rui Zhang <rui.zhang@intel.com> Acked-by: Rafael Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20131212141654.616820819@infradead.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpi_pad.c5
-rw-r--r--drivers/acpi/processor_idle.c15
-rw-r--r--drivers/idle/intel_idle.c11
-rw-r--r--drivers/thermal/intel_powerclamp.c4
4 files changed, 3 insertions, 32 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index fc6008fbce35..509452a62f96 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -193,10 +193,7 @@ static int power_saving_thread(void *data)
193 CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); 193 CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
194 stop_critical_timings(); 194 stop_critical_timings();
195 195
196 __monitor((void *)&current_thread_info()->flags, 0, 0); 196 mwait_idle_with_hints(power_saving_mwait_eax, 1);
197 smp_mb();
198 if (!need_resched())
199 __mwait(power_saving_mwait_eax, 1);
200 197
201 start_critical_timings(); 198 start_critical_timings();
202 if (lapic_marked_unstable) 199 if (lapic_marked_unstable)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 644516d9bde6..f90c56c8379e 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -727,11 +727,6 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
727 if (unlikely(!pr)) 727 if (unlikely(!pr))
728 return -EINVAL; 728 return -EINVAL;
729 729
730 if (cx->entry_method == ACPI_CSTATE_FFH) {
731 if (current_set_polling_and_test())
732 return -EINVAL;
733 }
734
735 lapic_timer_state_broadcast(pr, cx, 1); 730 lapic_timer_state_broadcast(pr, cx, 1);
736 acpi_idle_do_entry(cx); 731 acpi_idle_do_entry(cx);
737 732
@@ -785,11 +780,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
785 if (unlikely(!pr)) 780 if (unlikely(!pr))
786 return -EINVAL; 781 return -EINVAL;
787 782
788 if (cx->entry_method == ACPI_CSTATE_FFH) {
789 if (current_set_polling_and_test())
790 return -EINVAL;
791 }
792
793 /* 783 /*
794 * Must be done before busmaster disable as we might need to 784 * Must be done before busmaster disable as we might need to
795 * access HPET ! 785 * access HPET !
@@ -841,11 +831,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
841 } 831 }
842 } 832 }
843 833
844 if (cx->entry_method == ACPI_CSTATE_FFH) {
845 if (current_set_polling_and_test())
846 return -EINVAL;
847 }
848
849 acpi_unlazy_tlb(smp_processor_id()); 834 acpi_unlazy_tlb(smp_processor_id());
850 835
851 /* Tell the scheduler that we are going deep-idle: */ 836 /* Tell the scheduler that we are going deep-idle: */
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index f80b700f821c..efec4055fd5e 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -375,16 +375,7 @@ static int intel_idle(struct cpuidle_device *dev,
375 if (!(lapic_timer_reliable_states & (1 << (cstate)))) 375 if (!(lapic_timer_reliable_states & (1 << (cstate))))
376 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); 376 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
377 377
378 if (!current_set_polling_and_test()) { 378 mwait_idle_with_hints(eax, ecx);
379
380 if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR))
381 clflush((void *)&current_thread_info()->flags);
382
383 __monitor((void *)&current_thread_info()->flags, 0, 0);
384 smp_mb();
385 if (!need_resched())
386 __mwait(eax, ecx);
387 }
388 379
389 if (!(lapic_timer_reliable_states & (1 << (cstate)))) 380 if (!(lapic_timer_reliable_states & (1 << (cstate))))
390 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); 381 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
index 8f181b3f842b..e8275f2df9af 100644
--- a/drivers/thermal/intel_powerclamp.c
+++ b/drivers/thermal/intel_powerclamp.c
@@ -438,9 +438,7 @@ static int clamp_thread(void *arg)
438 */ 438 */
439 local_touch_nmi(); 439 local_touch_nmi();
440 stop_critical_timings(); 440 stop_critical_timings();
441 __monitor((void *)&current_thread_info()->flags, 0, 0); 441 mwait_idle_with_hints(eax, ecx);
442 cpu_relax(); /* allow HT sibling to run */
443 __mwait(eax, ecx);
444 start_critical_timings(); 442 start_critical_timings();
445 atomic_inc(&idle_wakeup_counter); 443 atomic_inc(&idle_wakeup_counter);
446 } 444 }