ia64/xen-unstable

changeset 18521:e61c7833dc9d

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 <gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Sep 22 11:24:02 2008 +0100 (2008-09-22)
parents 9cc4cebee50b
children 3c42b5ad0a4f
files xen/arch/x86/acpi/cpu_idle.c
line diff
     1.1 --- a/xen/arch/x86/acpi/cpu_idle.c	Mon Sep 22 11:21:31 2008 +0100
     1.2 +++ b/xen/arch/x86/acpi/cpu_idle.c	Mon Sep 22 11:24:02 2008 +0100
     1.3 @@ -63,6 +63,8 @@ extern void (*pm_idle) (void);
     1.4  static void (*pm_idle_save) (void) __read_mostly;
     1.5  unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER - 1;
     1.6  integer_param("max_cstate", max_cstate);
     1.7 +static int local_apic_timer_c2_ok __read_mostly = 0;
     1.8 +boolean_param("lapic_timer_c2_ok", local_apic_timer_c2_ok);
     1.9  
    1.10  static struct acpi_processor_power processor_powers[NR_CPUS];
    1.11  
    1.12 @@ -267,18 +269,21 @@ static void acpi_processor_idle(void)
    1.13          break;
    1.14  
    1.15      case ACPI_STATE_C2:
    1.16 -        /* Get start time (ticks) */
    1.17 -        t1 = inl(pmtmr_ioport);
    1.18 -        /* Invoke C2 */
    1.19 -        acpi_idle_do_entry(cx);
    1.20 -        /* Get end time (ticks) */
    1.21 -        t2 = inl(pmtmr_ioport);
    1.22 +        if ( local_apic_timer_c2_ok )
    1.23 +        {
    1.24 +            /* Get start time (ticks) */
    1.25 +            t1 = inl(pmtmr_ioport);
    1.26 +            /* Invoke C2 */
    1.27 +            acpi_idle_do_entry(cx);
    1.28 +            /* Get end time (ticks) */
    1.29 +            t2 = inl(pmtmr_ioport);
    1.30  
    1.31 -        /* Re-enable interrupts */
    1.32 -        local_irq_enable();
    1.33 -        /* Compute time (ticks) that we were actually asleep */
    1.34 -        sleep_ticks = ticks_elapsed(t1, t2);
    1.35 -        break;
    1.36 +            /* Re-enable interrupts */
    1.37 +            local_irq_enable();
    1.38 +            /* Compute time (ticks) that we were actually asleep */
    1.39 +            sleep_ticks = ticks_elapsed(t1, t2);
    1.40 +            break;
    1.41 +        }
    1.42  
    1.43      case ACPI_STATE_C3:
    1.44          /*