From: Keir Fraser Date: Mon, 22 Sep 2008 10:24:02 +0000 (+0100) Subject: CPUIDLE: Handle C2 LAPIC timer & TSC stop X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14101^2~49 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3724ccf9fa870fe57b543c353b0889bf3a9567a1;p=xen.git CPUIDLE: Handle C2 LAPIC timer & TSC stop ACPI C2 is quite possible mapped to CPU C3 or deeper state, so thinking from worst cases, enable C3 like entry/exit handling for C2 by default. Option 'lapic_timer_c2_ok' can be used to select simple C2 entry/exit only if the user make sure that LAPIC tmr & TSC will not be stop during C2. Signed-off-by: Wei Gang --- diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c index 872bfbf6e8..a91ace7a27 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -63,6 +63,8 @@ extern void (*pm_idle) (void); static void (*pm_idle_save) (void) __read_mostly; unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER - 1; integer_param("max_cstate", max_cstate); +static int local_apic_timer_c2_ok __read_mostly = 0; +boolean_param("lapic_timer_c2_ok", local_apic_timer_c2_ok); static struct acpi_processor_power processor_powers[NR_CPUS]; @@ -267,18 +269,21 @@ static void acpi_processor_idle(void) break; case ACPI_STATE_C2: - /* Get start time (ticks) */ - t1 = inl(pmtmr_ioport); - /* Invoke C2 */ - acpi_idle_do_entry(cx); - /* Get end time (ticks) */ - t2 = inl(pmtmr_ioport); - - /* Re-enable interrupts */ - local_irq_enable(); - /* Compute time (ticks) that we were actually asleep */ - sleep_ticks = ticks_elapsed(t1, t2); - break; + if ( local_apic_timer_c2_ok ) + { + /* Get start time (ticks) */ + t1 = inl(pmtmr_ioport); + /* Invoke C2 */ + acpi_idle_do_entry(cx); + /* Get end time (ticks) */ + t2 = inl(pmtmr_ioport); + + /* Re-enable interrupts */ + local_irq_enable(); + /* Compute time (ticks) that we were actually asleep */ + sleep_ticks = ticks_elapsed(t1, t2); + break; + } case ACPI_STATE_C3: /*