x86 hvm: Improve test for wait-for-SIPI state of a target VLAPIC.
authorKeir Fraser <keir@xen.org>
Wed, 20 Oct 2010 08:56:36 +0000 (09:56 +0100)
committerKeir Fraser <keir@xen.org>
Wed, 20 Oct 2010 08:56:36 +0000 (09:56 +0100)
This fixes a livelock in hvmloader with credit2 scheduler, whereby an
AP can be brought online, do its work, and shut itself down, before
the BSP re-emulates the VLAPIC write that sent the SIPI. BSP then ends
up in an endless re-emulation work where it sees the target vcpu is
down, therefore schedules a tasklet, which does no work because the
vcpu is already initialised. The fix is to check v->is_initialised
rather than VPF_down, before scheduling the tasklet.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/hvm/vlapic.c

index da513de0521bf459ba78609bcc9be130ecaf3fcb..3274d4deda038c4a3e7ee9935f3b3580be294532 100644 (file)
@@ -312,8 +312,8 @@ static int vlapic_accept_irq(struct vcpu *v, uint32_t icr_low)
         break;
 
     case APIC_DM_STARTUP:
-        /* Nothing to do if the VCPU is not on its way down. */
-        if ( !test_bit(_VPF_down, &v->pause_flags) )
+        /* Nothing to do if the VCPU is already initialised. */
+        if ( v->is_initialised )
             break;
         rc = vlapic_schedule_init_sipi_tasklet(v, icr_low);
         break;