From d8c8403561266b99bc078275242fbb9df48ed8bf Mon Sep 17 00:00:00 2001 From: "Yan, Like" Date: Tue, 12 Jun 2018 16:24:26 +0800 Subject: [PATCH] hv: replace vlapic_init by vlapic_reset in vcpu_reset This change is to fix a guest vm hang issue at vm reset, especially easy to be seen when it's a watchdog timeout reset. vlapic_init create and init vlapic.vlapic_timer without deleting the timer from cpu_times list, which breaks the list, results in a timer remains with callback points to an invalid location. Acked-by: Eddie Dong Signed-off-by: Yan, Like --- hypervisor/arch/x86/guest/vcpu.c | 2 +- hypervisor/arch/x86/guest/vlapic.c | 2 +- hypervisor/include/arch/x86/guest/vlapic.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/guest/vcpu.c b/hypervisor/arch/x86/guest/vcpu.c index eb95514ff..df7a5bd90 100644 --- a/hypervisor/arch/x86/guest/vcpu.c +++ b/hypervisor/arch/x86/guest/vcpu.c @@ -281,7 +281,7 @@ void reset_vcpu(struct vcpu *vcpu) vcpu->arch_vcpu.nr_sipi = 0; vcpu->pending_pre_work = 0; vlapic = vcpu->arch_vcpu.vlapic; - vlapic_init(vlapic); + vlapic_reset(vlapic); } void pause_vcpu(struct vcpu *vcpu, enum vcpu_state new_state) diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c index d63959c41..ae9eecbe8 100644 --- a/hypervisor/arch/x86/guest/vlapic.c +++ b/hypervisor/arch/x86/guest/vlapic.c @@ -1437,7 +1437,7 @@ vlapic_write(struct vlapic *vlapic, int mmio_access, uint64_t offset, return retval; } -static void +void vlapic_reset(struct vlapic *vlapic) { struct lapic *lapic; diff --git a/hypervisor/include/arch/x86/guest/vlapic.h b/hypervisor/include/arch/x86/guest/vlapic.h index c9047b57c..410e9faf1 100644 --- a/hypervisor/include/arch/x86/guest/vlapic.h +++ b/hypervisor/include/arch/x86/guest/vlapic.h @@ -119,6 +119,7 @@ uint8_t vlapic_get_apicid(struct vlapic *vlapic); int vlapic_create(struct vcpu *vcpu); void vlapic_free(struct vcpu *vcpu); void vlapic_init(struct vlapic *vlapic); +void vlapic_reset(struct vlapic *vlapic); void vlapic_restore(struct vlapic *vlapic, struct lapic_regs *regs); bool vlapic_enabled(struct vlapic *vlapic); uint64_t apicv_get_apic_access_addr(struct vm *vm);