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 1/3] Fix VCPU periodic timer

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1/3] Fix VCPU periodic timer
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
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: 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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 1/3] Fix VCPU periodic timer, Wei, Gang <=