From 8d7c92193b3f887c3ebe3d844786a2c435edbec3 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Wed, 14 May 2014 20:27:02 +0200 Subject: Improve the description of multi-processor setup --- arch/x86/machine/cpu.h | 7 +++++++ kern/kernel.c | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/x86/machine/cpu.h b/arch/x86/machine/cpu.h index ab31e5d8..cf2c112b 100644 --- a/arch/x86/machine/cpu.h +++ b/arch/x86/machine/cpu.h @@ -615,6 +615,13 @@ void cpu_mp_probe(void); /* * Start application processors. + * + * The x86 architecture uses per-CPU page tables, which are created as a + * side effect of this function. In order to synchronize their page tables, + * processors must be able to communicate very soon after calling this + * function. They communicate through interrupts and threading facilities. + * On return, physical mappings must not be altered until inter-processor + * communication is available. */ void cpu_mp_setup(void); diff --git a/kern/kernel.c b/kern/kernel.c index ea11bf2b..62d75b52 100644 --- a/kern/kernel.c +++ b/kern/kernel.c @@ -39,8 +39,17 @@ kernel_main(void) llsync_setup(); /* - * Enabling application processors must be the last step before starting - * the scheduler. + * Enabling application processors is done late in the boot process for + * two reasons : + * - It's much simpler to bootstrap with interrupts disabled on all + * processors, enabling them only when necessary on the BSP. + * - Depending on the architecture, the pmap module could create per + * processor page tables. Once done, keeping the kernel page tables + * synchronized requires interrupts (and potentially scheduling) + * enabled on all processors. + * + * Anything done after this call and before running the scheduler must + * not alter physical mappings. */ cpu_mp_setup(); -- cgit v1.2.3