From 540841ac5dadd80b316531ff8ee212606d4be4c7 Mon Sep 17 00:00:00 2001 From: "Li, Fei1" Date: Mon, 15 Jul 2019 17:55:42 +0800 Subject: [PATCH] hv: vlapic: EOI exit bitmap should set or clear atomically For per-vCPU, EOI exit bitmap is a global parameter which should set or clear atomically since there's no lock to protect this critical variable. Tracked-On: #1842 Signed-off-by: Li, Fei1 Reviewed-by: Yin Fengwei --- hypervisor/arch/x86/guest/vcpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/guest/vcpu.c b/hypervisor/arch/x86/guest/vcpu.c index 6a55b79e0..380e90da6 100644 --- a/hypervisor/arch/x86/guest/vcpu.c +++ b/hypervisor/arch/x86/guest/vcpu.c @@ -168,7 +168,7 @@ void vcpu_set_eoi_exit_bitmap(struct acrn_vcpu *vcpu, uint32_t vector) { pr_dbg("%s", __func__); - if (!bitmap_test_and_set_nolock((uint16_t)(vector & 0x3fU), + if (!bitmap_test_and_set_lock((uint16_t)(vector & 0x3fU), &(vcpu->arch.eoi_exit_bitmap[(vector & 0xffU) >> 6U]))) { vcpu_make_request(vcpu, ACRN_REQUEST_EOI_EXIT_BITMAP_UPDATE); } @@ -178,7 +178,7 @@ void vcpu_clear_eoi_exit_bitmap(struct acrn_vcpu *vcpu, uint32_t vector) { pr_dbg("%s", __func__); - if (bitmap_test_and_clear_nolock((uint16_t)(vector & 0x3fU), + if (bitmap_test_and_clear_lock((uint16_t)(vector & 0x3fU), &(vcpu->arch.eoi_exit_bitmap[(vector & 0xffU) >> 6U]))) { vcpu_make_request(vcpu, ACRN_REQUEST_EOI_EXIT_BITMAP_UPDATE); }