Skip to contentSkip to conversation

hvm/vpt: Check that an irq is not blocked before waking the vcpu

PATCH In review George Dunlap 3 participants 4 messages Mar 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hvm/vpt: Check that an irq is not blocked before waking the vcpu

Currently, when a timer fires for a vpt interrupt, the interrupt handler calls vcpu_kick() without checking to see if the IRQ is blocked. This causes the vcpu to wake up out of a halt when it shouldn't.

xen/arch/x86/hvm/vpt.c +2 -1
diff -r b249f3e979a5 xen/arch/x86/hvm/vpt.c
@@ -209,7 +209,8 @@
         set_timer(&pt->timer, pt->scheduled);
     }
 
-    vcpu_kick(pt->vcpu);
+    if ( !pt_irq_masked(pt) )
+        vcpu_kick(pt->vcpu);
 
     pt_unlock(pt);
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · George Dunlap

Currently, when a timer fires for a vpt interrupt, the interrupt handler calls vcpu_kick() without checking to see if the IRQ is blocked. This causes the vcpu to wake up out of a halt when it shouldn't.

Only one question: could this race an unmask operation? Before this patch, pt_irq_masked() is only executed for the local vcpu, so such races may not have been considered.

-- Keir

#2 lore raw

I can't think of a way this race could be a problem. Even if the vcpu in question were to unmask right after the check, it would still call pt_update_irq() on the way out to the vmexit (just for good measure), which would catch the IRQ just as it should.

Conversely, if the vcpu were to mask right after the check, there should be enough delay between the mask and executing a HLT that the kick() wouldn't have any significant effect. Even if it did, this patch would reduce the false wake-ups from "every time the timer fires when masked" to "only when a very specific race happens".

But the timer code is complicated enough that I'd like some corroboration with someone who knows it better...

-George

Quoted 22 lines · Keir Fraser
Quoted 6 lines · George Dunlap

Currently, when a timer fires for a vpt interrupt, the interrupt handler calls vcpu_kick() without checking to see if the IRQ is blocked.  This causes the vcpu to wake up out of a halt when it shouldn't.

Only one question: could this race an unmask operation? Before this patch, pt_irq_masked() is only executed for the local vcpu, so such races may not have been considered.

 -- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

How do I restrict a Domu to a CPU

In Xen 3.3 (SLES 11) I am adding (cpu 2-15) in the *.sxp file, but after that the Vir-manager cannot open the console. If I remove that line, it works fine. I need to both be able to restrict the domain to a set of CPU's and see the VNC console. Any idea??
Federico