[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] cpuidle: Fix for timer_deadline==0 case



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1241082300 -3600
# Node ID ecf6277e0f6600f8537b1f3b616a06f28ed41484
# Parent  54dbd70406ad9b303505380fb893d1b3c928267b
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@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hpet.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff -r 54dbd70406ad -r ecf6277e0f66 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Thu Apr 30 09:43:29 2009 +0100
+++ b/xen/arch/x86/hpet.c       Thu Apr 30 10:05:00 2009 +0100
@@ -25,7 +25,7 @@
 #define HPET_EVT_USED_BIT    0
 #define HPET_EVT_USED       (1 << HPET_EVT_USED_BIT)
 #define HPET_EVT_DISABLE_BIT 1
-#define HPET_EVT_DISALBE    (1 << HPET_EVT_DISABLE_BIT)
+#define HPET_EVT_DISABLE    (1 << HPET_EVT_DISABLE_BIT)
 
 struct hpet_event_channel
 {
@@ -119,12 +119,12 @@ static int reprogram_hpet_evt_channel(
     int64_t delta;
     int ret;
 
-    if ( ch->flags & HPET_EVT_DISALBE )
+    if ( (ch->flags & HPET_EVT_DISABLE) || (expire == 0) )
         return 0;
 
     if ( unlikely(expire < 0) )
     {
-        printk(KERN_DEBUG "reprogram: expire < 0\n");
+        printk(KERN_DEBUG "reprogram: expire <= 0\n");
         return -ETIME;
     }
 
@@ -560,7 +560,7 @@ void hpet_broadcast_init(void)
         return;
     }
 
-    if ( legacy_hpet_event.flags & HPET_EVT_DISALBE )
+    if ( legacy_hpet_event.flags & HPET_EVT_DISABLE )
         return;
 
     hpet_id = hpet_read32(HPET_ID);
@@ -603,7 +603,7 @@ void hpet_disable_legacy_broadcast(void)
 
     spin_lock_irq(&legacy_hpet_event.lock);
 
-    legacy_hpet_event.flags |= HPET_EVT_DISALBE;
+    legacy_hpet_event.flags |= HPET_EVT_DISABLE;
 
     /* disable HPET T0 */
     cfg = hpet_read32(HPET_T0_CFG);
@@ -624,6 +624,9 @@ void hpet_broadcast_enter(void)
 {
     int cpu = smp_processor_id();
     struct hpet_event_channel *ch = per_cpu(cpu_bc_channel, cpu);
+
+    if ( this_cpu(timer_deadline) == 0 )
+        return;
 
     if ( !ch )
         ch = hpet_get_channel(cpu);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.