WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] cpuidle: Fix for timer_deadline==0 case

To: "Xen-Devel (E-mail)" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] cpuidle: Fix for timer_deadline==0 case
From: "Wei, Gang" <gang.wei@xxxxxxxxx>
Date: Thu, 30 Apr 2009 16:30:52 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Thu, 30 Apr 2009 01:31:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcnJbfkRznk3BAyHSIivQPIeqv1d8g==
Thread-topic: [PATCH] cpuidle: Fix for timer_deadline==0 case
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.

The fix is if timer_deadline == 0, skip most hpet broadcast enter logic because 
no broadcast is needed for this cpu. Meanwhile strengthen the check in 
reprogram_hpet_evt_channel, treating (expire <= 0) as a hint for no need to 
reprogram hpet.

Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>

diff -r f734a724902b xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Mon Apr 27 18:59:56 2009 +0100
+++ b/xen/arch/x86/hpet.c       Thu Apr 30 14:45:01 2009 +0800
@@ -122,10 +122,10 @@ static int reprogram_hpet_evt_channel(
     if ( ch->flags & HPET_EVT_DISALBE )
         return 0;
 
-    if ( unlikely(expire < 0) )
+    if ( unlikely(expire <= 0) )
     {
-        printk(KERN_DEBUG "reprogram: expire < 0\n");
-        return -ETIME;
+        printk(KERN_DEBUG "reprogram: expire <= 0\n");
+        return 0;
     }
 
     delta = expire - now;
@@ -625,6 +625,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);
     BUG_ON( !ch );

Jimmy

Attachment: fix-long-c1-on-pure-idle-cpu.patch
Description: fix-long-c1-on-pure-idle-cpu.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] cpuidle: Fix for timer_deadline==0 case, Wei, Gang <=