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>
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 18:32:50 +0900
Cc: Christoph Egger <Christoph.Egger@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 25 Sep 2009 02:33:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C6E236AF.15C3A%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: <7kzl8jprl5.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxx> <C6E236AF.15C3A%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Keir Fraser writes:
> This patch is very dubious. It appears to break pt_process_missed_ticks()
> logic for timer modes 0 and 1. When a VCPU gets rescheduled it will have
> missed ticks folded into ->scheduled and ->pending_intr_nr fields, but since
> you stomp on the logic for tracking pending_intr_nr, most of those missed
> ticks will never get delivered.

I've forgotten VCPU switch. Indeed, it's pretty fragile. :-)
What about modifying pt_restore_timer() not to advance pt->scheduled?
For example,

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 18:12:12 2009 +0900
@@ -189,8 +189,10 @@ void pt_restore_timer(struct vcpu *v)
     {
         if ( pt->pending_intr_nr == 0 )
         {
-            pt_process_missed_ticks(pt);
-            set_timer(&pt->timer, pt->scheduled);
+            if ( pt->scheduled > NOW() )
+                set_timer(&pt->timer, pt->scheduled);
+            else
+                pt->pending_intr_nr = 1;
         }
     }

We should rename pending_intr_nr to pending_intr(boolean).

Thanks,
Kouya

> I think the fix is to move the line 'pt->scheduled += pt->period' out of
> pt_intr_post() and back into pt_timer_fn(). This is because you have
> otherwise broken the invariant that pt->scheduled always gets incremented
> along with pt->pending_intr_nr. All the rest of your 'fixes' are I think
> merely working around that fundamental brokeness.
> 
> Please try moving that one line and see if the bug goes away.
> 
>  -- Keir
>  
> On 25/09/2009 05:37, "Kouya Shimura" <kouya@xxxxxxxxxxxxxx> wrote:
> 
> > Although c/s 20229 fixes missing ticks issue in c/s 20218,
> > it's not enough.
> > 
> > - set a timer to the next period more straightforwardly.
> > - fix an unexpected behavior of both timer_mode=2 and timer_mode=3.
> >   extra interrupts might be delivered to a guest.
> > 
> > Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
> > 
> 

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