Skip to content

Commit a71e491

Browse files
committed
ACPI: idle: mark_tsc_unstable() at init-time, not run-time
The c2 and c3 idle handlers check tsc_halts_in_c() after every time they return from idle. Um, when?:-) Move this check to init-time to remove the unnecessary run-time overhead, and also to have the check complete before the first entry into the idle handler. ff69f2b (acpi: fix of pmtimer overflow that make Cx states time incorrect) replaced the hard-coded use of the PM-timer inside idle, with ktime_get_readl(), which possibly uses the TSC -- so it is now especially prudent to detect a broken TSC before entering idle. http://bugzilla.kernel.org/show_bug.cgi?id=13087 Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 0910697 commit a71e491

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

‎drivers/acpi/processor_idle.c‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,11 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
581581
for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
582582
struct acpi_processor_cx *cx = &pr->power.states[i];
583583

584+
#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
585+
/* TSC could halt in idle, so notify users */
586+
if (tsc_halts_in_c(cx->type))
587+
mark_tsc_unstable("TSC halts in idle");;
588+
#endif
584589
switch (cx->type) {
585590
case ACPI_STATE_C1:
586591
cx->valid = 1;
@@ -871,11 +876,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
871876
kt2 = ktime_get_real();
872877
idle_time = ktime_to_us(ktime_sub(kt2, kt1));
873878

874-
#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
875-
/* TSC could halt in idle, so notify users */
876-
if (tsc_halts_in_c(cx->type))
877-
mark_tsc_unstable("TSC halts in idle");;
878-
#endif
879879
sleep_ticks = us_to_pm_timer_ticks(idle_time);
880880

881881
/* Tell the scheduler how much we idled: */
@@ -989,11 +989,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
989989
spin_unlock(&c3_lock);
990990
}
991991

992-
#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
993-
/* TSC could halt in idle, so notify users */
994-
if (tsc_halts_in_c(ACPI_STATE_C3))
995-
mark_tsc_unstable("TSC halts in idle");
996-
#endif
997992
sleep_ticks = us_to_pm_timer_ticks(idle_time);
998993
/* Tell the scheduler how much we idled: */
999994
sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);

0 commit comments

Comments
 (0)