From 9a6e94084953a2d6300bb9baa9aa69cf5d274e31 Mon Sep 17 00:00:00 2001 From: Wu Zhou Date: Tue, 5 Sep 2023 14:39:35 +0800 Subject: [PATCH] hv: signal_event after make_request make_request sets the request bit, and signal_event wakes the vcpu thread. If we signal_event comes first, the target vCPU has a chance to sleep again before processing the request bit. Tracked-On: #8507 Signed-off-by: Wu Zhou Reviewed-by: Junjie Mao --- hypervisor/arch/x86/guest/vcpu.c | 2 +- hypervisor/arch/x86/guest/vlapic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/guest/vcpu.c b/hypervisor/arch/x86/guest/vcpu.c index 8a53f97d7..a65d9ac5a 100755 --- a/hypervisor/arch/x86/guest/vcpu.c +++ b/hypervisor/arch/x86/guest/vcpu.c @@ -1049,8 +1049,8 @@ void vcpu_handle_pi_notification(uint32_t vcpu_index) * Record this request as ACRN_REQUEST_EVENT, * so that vlapic_inject_intr() will sync PIR to vIRR */ - signal_event(&vcpu->events[VCPU_EVENT_VIRTUAL_INTERRUPT]); vcpu_make_request(vcpu, ACRN_REQUEST_EVENT); + signal_event(&vcpu->events[VCPU_EVENT_VIRTUAL_INTERRUPT]); } } } diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c index fdd856981..d25847b46 100644 --- a/hypervisor/arch/x86/guest/vlapic.c +++ b/hypervisor/arch/x86/guest/vlapic.c @@ -532,8 +532,8 @@ static void vlapic_accept_intr(struct acrn_vlapic *vlapic, uint32_t vector, bool if ((lapic->svr.v & APIC_SVR_ENABLE) == 0U) { dev_dbg(DBG_LEVEL_VLAPIC, "vlapic is software disabled, ignoring interrupt %u", vector); } else { - signal_event(&vlapic2vcpu(vlapic)->events[VCPU_EVENT_VIRTUAL_INTERRUPT]); vlapic->ops->accept_intr(vlapic, vector, level); + signal_event(&vlapic2vcpu(vlapic)->events[VCPU_EVENT_VIRTUAL_INTERRUPT]); } }