From b1dd3e26f5dbd6ae5e2891e6876bf2a36dc565f6 Mon Sep 17 00:00:00 2001 From: "Li, Fei1" Date: Tue, 16 Jul 2019 21:35:53 +0800 Subject: [PATCH] hv: cpu: pcpu_active_bitmap should be set atomically It's a global parameter and could be set concurrently. So it should be set atomically. Tracked-On: #1842 Signed-off-by: Li, Fei1 Reviewed-by: Yin Fenwgei --- hypervisor/arch/x86/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 48eec90b5..4c60bf9fe 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -154,7 +154,7 @@ void init_pcpu_pre(uint16_t pcpu_id_args) } } - bitmap_set_nolock(pcpu_id, &pcpu_active_bitmap); + bitmap_set_lock(pcpu_id, &pcpu_active_bitmap); /* Set state for this CPU to initializing */ pcpu_set_current_state(pcpu_id, PCPU_STATE_INITIALIZING); @@ -387,7 +387,7 @@ void cpu_dead(void) /* Set state to show CPU is dead */ pcpu_set_current_state(pcpu_id, PCPU_STATE_DEAD); - bitmap_clear_nolock(pcpu_id, &pcpu_active_bitmap); + bitmap_clear_lock(pcpu_id, &pcpu_active_bitmap); /* Halt the CPU */ do {