Skip to content

Commit

Permalink
hv: vlapic: EOI exit bitmap should set or clear atomically
Browse files Browse the repository at this point in the history
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 <fei1.li@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
  • Loading branch information
lifeix authored and acrnsi committed Jul 17, 2019
1 parent 0eb0854 commit 540841a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hypervisor/arch/x86/guest/vcpu.c
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 540841a

Please sign in to comment.