Skip to content

Commit

Permalink
smp: perform full AP initialization before releasing
Browse files Browse the repository at this point in the history
All initialization routines and settings must be through, before
letting BSP continue.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Nov 13, 2023
1 parent c481fb1 commit 6bf4da9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions smp/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ void __noreturn ap_startup(void) {
init_traps(cpu);
init_apic(ap_cpuid, apic_get_mode());

ap_callin = true;
smp_wmb();

init_timers(cpu);
sti();

if (opt_fpu)
enable_fpu();

/* Release BSP after full AP initialization */
ap_callin = true;
smp_wmb();

while (true)
run_tasks(cpu);

Expand Down Expand Up @@ -103,6 +104,7 @@ static __text_init void boot_cpu(cpu_t *cpu) {

apic_wait_ready();

/* Wait for AP initialization */
while (!ap_callin)
cpu_relax();

Expand Down

0 comments on commit 6bf4da9

Please sign in to comment.