From 5f281df548b85304c6bf043d904f056fdcc1f391 Mon Sep 17 00:00:00 2001 From: Li Fei1 Date: Mon, 19 Apr 2021 11:02:11 +0800 Subject: [PATCH] hv: serializng: use mfence to ensure trampoline code was updated Using the MFENCE to make sure trampoline code has been updated (clflush) into memory beforing start APs. Tracked-On: #5929 Signed-off-by: Li Fei1 --- hypervisor/arch/x86/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 41e11c1fe..ef804463f 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -322,6 +322,10 @@ static void start_pcpu(uint16_t pcpu_id) write_trampoline_stack_sym(pcpu_id); clac(); + /* Using the MFENCE to make sure trampoline code + * has been updated (clflush) into memory beforing start APs. + */ + cpu_memory_barrier(); send_startup_ipi(pcpu_id, startup_paddr); /* Wait until the pcpu with pcpu_id is running and set the active bitmap or