ia64/xen-unstable

changeset 19587:ecf6277e0f66

cpuidle: Fix for timer_deadline==0 case

After the scheduler timer became suspended before entering cpu idle
state, the percpu timer_deadline is possible to be 0, i.e. no soft
timer in the queue. This case will cause unexpected large residency
percentage in C1 for the purely idle cpu.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Apr 30 10:05:00 2009 +0100 (2009-04-30)
parents 54dbd70406ad
children 22e01301ff64
files xen/arch/x86/hpet.c
line diff
     1.1 --- a/xen/arch/x86/hpet.c	Thu Apr 30 09:43:29 2009 +0100
     1.2 +++ b/xen/arch/x86/hpet.c	Thu Apr 30 10:05:00 2009 +0100
     1.3 @@ -25,7 +25,7 @@
     1.4  #define HPET_EVT_USED_BIT    0
     1.5  #define HPET_EVT_USED       (1 << HPET_EVT_USED_BIT)
     1.6  #define HPET_EVT_DISABLE_BIT 1
     1.7 -#define HPET_EVT_DISALBE    (1 << HPET_EVT_DISABLE_BIT)
     1.8 +#define HPET_EVT_DISABLE    (1 << HPET_EVT_DISABLE_BIT)
     1.9  
    1.10  struct hpet_event_channel
    1.11  {
    1.12 @@ -119,12 +119,12 @@ static int reprogram_hpet_evt_channel(
    1.13      int64_t delta;
    1.14      int ret;
    1.15  
    1.16 -    if ( ch->flags & HPET_EVT_DISALBE )
    1.17 +    if ( (ch->flags & HPET_EVT_DISABLE) || (expire == 0) )
    1.18          return 0;
    1.19  
    1.20      if ( unlikely(expire < 0) )
    1.21      {
    1.22 -        printk(KERN_DEBUG "reprogram: expire < 0\n");
    1.23 +        printk(KERN_DEBUG "reprogram: expire <= 0\n");
    1.24          return -ETIME;
    1.25      }
    1.26  
    1.27 @@ -560,7 +560,7 @@ void hpet_broadcast_init(void)
    1.28          return;
    1.29      }
    1.30  
    1.31 -    if ( legacy_hpet_event.flags & HPET_EVT_DISALBE )
    1.32 +    if ( legacy_hpet_event.flags & HPET_EVT_DISABLE )
    1.33          return;
    1.34  
    1.35      hpet_id = hpet_read32(HPET_ID);
    1.36 @@ -603,7 +603,7 @@ void hpet_disable_legacy_broadcast(void)
    1.37  
    1.38      spin_lock_irq(&legacy_hpet_event.lock);
    1.39  
    1.40 -    legacy_hpet_event.flags |= HPET_EVT_DISALBE;
    1.41 +    legacy_hpet_event.flags |= HPET_EVT_DISABLE;
    1.42  
    1.43      /* disable HPET T0 */
    1.44      cfg = hpet_read32(HPET_T0_CFG);
    1.45 @@ -625,6 +625,9 @@ void hpet_broadcast_enter(void)
    1.46      int cpu = smp_processor_id();
    1.47      struct hpet_event_channel *ch = per_cpu(cpu_bc_channel, cpu);
    1.48  
    1.49 +    if ( this_cpu(timer_deadline) == 0 )
    1.50 +        return;
    1.51 +
    1.52      if ( !ch )
    1.53          ch = hpet_get_channel(cpu);
    1.54      BUG_ON( !ch );