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/
Home Products Support Community News


[Xen-changelog] Under some specific conditions, dom0 will lose guest tim

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Under some specific conditions, dom0 will lose guest timer interrupt.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 21 Dec 2005 20:42:09 +0000
Delivery-date: Wed, 21 Dec 2005 20:45:30 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User djm@xxxxxxxxxxxxxxx
# Node ID f998426f9069aa9e4e060ceb48a3cd9cfc1231d9
# Parent  dda94d6dce94447d29eaf64c53e6e6315e4ac96e
Under some specific conditions, dom0 will lose guest timer interrupt.
Signed-off-by Anthony Xu <anthony.xu@xxxxxxxxx>
Signed-off-by Kevin Tian <kevin.tian@xxxxxxxxx>
The reason is that Xen/ia64 will try to pend guest timer interrupt to dom0
within each machine timer interrupt handler. To avoid duplicated delivery, 
domain_itm_last recorded domain_itm of last injection. If two are identical,
it means interrupt injected but guest has not set new itm value. Or else
corresponding pending irr bit will be turned on. That works in most cases.

However currently guest linux may try to set itm multiple times within one
handler before turn on psr.i again. Among first few settings, new guest timer
interrupt may be pended. Then once guest linux enables interrupt, a new
timer interrupt will be injected immediately. However this injection may have
itc still smaller than the domain_itm set at the last round of last handle.
In this case, guest linux will set same domain_itm as last again. However
since domain_itm_last already equals to domain_itm at last read ivr, later
no guest timer interrupt can be injected any more since Xen always thinks
an instance already injected without guest's response.

Attahced patch fixed this issue by adding sanity check upon guest timer
vector when deciding to inject interrupt into dom0. We always compare current
itc with latest domain_itm that guest really wants. So if itc < domain_itm
at this point, we simply clear the pending bit and no injection.

There's also a small fix to vcpu_read_ivr, where domain_itm_last should
be updated before clearing irr bit. Or els a small window still remains
to add a duplicate interrupt.

diff -r dda94d6dce94 -r f998426f9069 xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c  Thu Dec 15 20:51:10 2005
+++ b/xen/arch/ia64/xen/vcpu.c  Thu Dec 15 22:07:47 2005
@@ -676,6 +676,7 @@
         * event injection without handle. Later guest may throw out
         * the event itself.
        if (event_pending(vcpu) && 
                        &PSCBX(vcpu, insvc[0])))
@@ -702,6 +703,15 @@
 //printf("XXXXXXX vcpu_check_pending_interrupts: got bitnum=%p...",bitnum);
        vector = bitnum+(i*64);
        mask = 1L << bitnum;
+       /* sanity check for guest timer interrupt */
+       if (vector == (PSCB(vcpu,itv) & 0xff)) {
+               uint64_t now = ia64_get_itc();
+               if (now < PSCBX(vcpu,domain_itm)) {
+                       printk("Ooops, pending guest timer before its due\n");
+                       PSCBX(vcpu,irr[i]) &= ~mask;
+                       goto check_start;
+               }
+       }
 //printf("XXXXXXX vcpu_check_pending_interrupts: got vector=%p...",vector);
        if (*r >= mask) {
                // masked by equal inservice
@@ -798,6 +808,13 @@
+       /* if delivering a timer interrupt, remember domain_itm, which
+        * needs to be done before clearing irr
+        */
+       if (vector == (PSCB(vcpu,itv) & 0xff)) {
+               PSCBX(vcpu,domain_itm_last) = PSCBX(vcpu,domain_itm);
+       }
        i = vector >> 6;
        mask = 1L << (vector & 0x3f);
 //printf("ZZZZZZ vcpu_get_ivr: setting insvc mask for vector %ld\n",vector);
@@ -805,10 +822,6 @@
        PSCBX(vcpu,irr[i]) &= ~mask;
        *pval = vector;
-       // if delivering a timer interrupt, remember domain_itm
-       if (vector == (PSCB(vcpu,itv) & 0xff)) {
-               PSCBX(vcpu,domain_itm_last) = PSCBX(vcpu,domain_itm);
-       }
        return IA64_NO_FAULT;

Xen-changelog mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Under some specific conditions, dom0 will lose guest timer interrupt., Xen patchbot -unstable <=