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

[Xen-devel] [PATCH 1/3] Fix VCPU periodic timer


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Wei, Gang" <gang.wei@xxxxxxxxx>
  • Date: Wed, 3 Sep 2008 09:52:02 +0800
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Delivery-date: Tue, 02 Sep 2008 18:52:37 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AckNZ6k8F37EmDAqQ3KgHxcfHg1Nrg==
  • Thread-topic: [PATCH 1/3] Fix VCPU periodic timer

Fix for VCPU periodic timer.

Idle vcpu periodic timer is useless. It increased the lapic timer interrupt 
number, which decreased the cpu idle residency. This patch disables idle vcpu 
periodic timer via keeping v->periodic_period = 0.

The vcpu periodic timer may be expired 50us before expected time because there 
is a 50us TIMER_SLOP used for soft timer (xen/common/timer.c, 
timer_softirq_action()). This will cause vcpu_periodic_timer_work() be 
continuously called tens of times in a single call of timer_softirq_action() 
until (now > periodic_next_event). It brings unnecessary overhead. This patch 
adds a similar time slop in vcpu periodic timer to eliminate this overhead.

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

diff -r b6eea72ea9dc xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Mon Sep 01 11:29:01 2008 +0100
+++ b/xen/arch/x86/domain.c     Wed Sep 03 09:36:36 2008 +0800
@@ -302,7 +302,8 @@ int vcpu_initialise(struct vcpu *v)
     else
     {
         /* PV guests by default have a 100Hz ticker. */
-        v->periodic_period = MILLISECS(10);
+        if ( !is_idle_domain(d) )
+            v->periodic_period = MILLISECS(10);

         /* PV guests get an emulated PIT too for video BIOSes to use. */
         if ( !is_idle_domain(d) && (v->vcpu_id == 0) )
diff -r b6eea72ea9dc xen/common/schedule.c
--- a/xen/common/schedule.c     Mon Sep 01 11:29:01 2008 +0100
+++ b/xen/common/schedule.c     Tue Sep 02 18:25:32 2008 +0800
@@ -628,7 +628,12 @@ static void vcpu_periodic_timer_work(str
         return;

     periodic_next_event = v->periodic_last_event + v->periodic_period;
-    if ( now > periodic_next_event )
+
+    /*
+     * timer_softirq_action() may call this TIMER_SLOP (50us) before expected,
+     * TIME_SLOP avoids it calling into this tens of times to make it fired.
+     */
+    if ( now + TIME_SLOP  > periodic_next_event )
     {
         send_timer_event(v);
         v->periodic_last_event = now;

Attachment: vcpu-periodic-timer-fix-0903.patch
Description: vcpu-periodic-timer-fix-0903.patch

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

 


Rackspace

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