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] Re: [PATCH] x86 hvm: fix missing ticks issue in c/s 20218

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Christoph Egger <Christoph.Egger@xxxxxxx>
Subject: [Xen-devel] Re: [PATCH] x86 hvm: fix missing ticks issue in c/s 20218
From: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Date: Fri, 25 Sep 2009 21:25:11 +0900
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 25 Sep 2009 05:25:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C6E2521A.15C61%keir.fraser@xxxxxxxxxxxxx>
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>
References: <7kws3npdwy.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxx> <C6E2521A.15C61%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Keir, 
Okay, attached is a new patch per your advice. 
I tested it carefully. It works for me.

Christoph,
Could you please test it?

Thanks,
Kouya

Keir Fraser writes:
> On 25/09/2009 10:32, "Kouya Shimura" <kouya@xxxxxxxxxxxxxx> wrote:
> 
> > I've forgotten VCPU switch. Indeed, it's pretty fragile. :-)
> > What about modifying pt_restore_timer() not to advance pt->scheduled?
> > We should rename pending_intr_nr to pending_intr(boolean).
> 
> It's not clear to me that the old logic around pt->pending_intr_nr and
> pt->scheduled really needs to change that drastically. The more we mess with
> this code the more likely we are to break stuff, as it's hard to get good
> coverage of the timer_modes and various ways guest Oses may manage their
> timers.
> 
> I would prefer to see whether moving the update of pt->scheduled out of
> pt_intr_post() and back into the timer_fn() works. That moves us back
> towards what we had before your patches, and therefore I'm more comfortable
> with it.
> 
>  -- Keir
> 

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>

diff -r 0f8376078dc1 xen/arch/x86/hvm/vpt.c
--- a/xen/arch/x86/hvm/vpt.c    Wed Sep 23 18:19:30 2009 +0100
+++ b/xen/arch/x86/hvm/vpt.c    Fri Sep 25 20:51:52 2009 +0900
@@ -206,6 +206,7 @@ static void pt_timer_fn(void *data)
     pt_lock(pt);
 
     pt->pending_intr_nr++;
+    pt->scheduled += pt->period;
     pt->do_not_freeze = 0;
 
     vcpu_kick(pt->vcpu);
@@ -308,25 +309,24 @@ void pt_intr_post(struct vcpu *v, struct
     }
     else
     {
-        pt->scheduled += pt->period;
-
         if ( mode_is(v->domain, one_missed_tick_pending) ||
              mode_is(v->domain, no_missed_ticks_pending) )
         {
             pt->last_plt_gtime = hvm_get_guest_time(v);
+            pt_process_missed_ticks(pt);
             pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */
+            set_timer(&pt->timer, pt->scheduled);
         }
         else
         {
             pt->last_plt_gtime += pt->period;
             pt->pending_intr_nr--;
-        }
-
-        if ( pt->pending_intr_nr == 0 )
-        {
-            pt_process_missed_ticks(pt);
-            pt->do_not_freeze = 0;
-            set_timer(&pt->timer, pt->scheduled);
+            if ( pt->pending_intr_nr == 0 )
+            {
+                pt_process_missed_ticks(pt);
+                if ( pt->pending_intr_nr == 0 )
+                    set_timer(&pt->timer, pt->scheduled);
+            }
         }
     }
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel