From 619c600021983e08eef0ddcbb378754be5fb1a87 Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Fri, 13 Jul 2018 17:21:21 +0800 Subject: [PATCH] hv: cpu state update should be moved just before halt. The cpu offline requester monitor the target cpu state to detect whether target cpu is put to offline already. So we should only update the cpu state to offline after all other operations are finished. Signed-off-by: Yin Fengwei Reviewed-by: Eddie Dong Acked-by: Anthony Xu --- hypervisor/arch/x86/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 14f50ee8b..1e1c546cb 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -750,14 +750,14 @@ void cpu_dead(uint16_t pcpu_id) return; } - /* Set state to show CPU is dead */ - cpu_set_current_state(pcpu_id, CPU_STATE_DEAD); - /* clean up native stuff */ timer_cleanup(); vmx_off(pcpu_id); CACHE_FLUSH_INVALIDATE_ALL(); + /* Set state to show CPU is dead */ + cpu_set_current_state(pcpu_id, CPU_STATE_DEAD); + /* Halt the CPU */ do { asm volatile ("hlt");