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

[Xen-changelog] [xen-unstable] Fix for VCPU periodic timer.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1220436177 -3600
# Node ID 021189f8cd784755d9b45ab5e9b947cc38b37f2b
# Parent  3e72ab517e44e81b9e1414595879e46df5150255
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>
---
 xen/arch/x86/domain.c |    3 ++-
 xen/common/schedule.c |    4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff -r 3e72ab517e44 -r 021189f8cd78 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Wed Sep 03 10:38:33 2008 +0100
+++ b/xen/arch/x86/domain.c     Wed Sep 03 11:02:57 2008 +0100
@@ -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 3e72ab517e44 -r 021189f8cd78 xen/common/schedule.c
--- a/xen/common/schedule.c     Wed Sep 03 10:38:33 2008 +0100
+++ b/xen/common/schedule.c     Wed Sep 03 11:02:57 2008 +0100
@@ -628,7 +628,9 @@ static void vcpu_periodic_timer_work(str
         return;
 
     periodic_next_event = v->periodic_last_event + v->periodic_period;
-    if ( now > periodic_next_event )
+
+    /* The timer subsystem may call us up to TIME_SLOP ahead of deadline. */
+    if ( (now + TIME_SLOP) > periodic_next_event )
     {
         send_timer_event(v);
         v->periodic_last_event = now;

_______________________________________________
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®.