From 02a1e21c3d20904f44a40ab0f068357f1814a635 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Thu, 14 Feb 2019 19:40:54 -0800 Subject: [PATCH] x86_64: Missing a volatile on a struct used for spinning Before we're initialized and can use proper synchronization, the CPU initialization path spins on the thread entry function to be non-null. But the data wasn't tagged volatile, and with gcc 8.2.1 (but not 6.2.0) the optimizer was hoisting the reads to SMP init would spin forever. Signed-off-by: Andy Ross --- arch/x86_64/core/x86_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86_64/core/x86_64.c b/arch/x86_64/core/x86_64.c index cb5a445cb84..7480a485c40 100644 --- a/arch/x86_64/core/x86_64.c +++ b/arch/x86_64/core/x86_64.c @@ -69,7 +69,7 @@ void *_isr_exit_restore_stack(void *interrupted) return (nested || next == interrupted) ? NULL : next; } -struct { +volatile struct { void (*fn)(int, void*); void *arg; } cpu_init[CONFIG_MP_NUM_CPUS];