2009年12月6日 星期日

How all the secondary cores boot in MPCore

http://lists.arm.linux.org.uk/lurker/message/20080611.175337.ecfc6e1c.en.html#linux-arm

Author: Catalin Marinas
Date: 2008-06-12 01:53 +800
To: Charly Bechara
CC: linux-arm
Subject: Re: How all the secondary cores boot in MPCore
On Wed, 2008-06-11 at 15:33 +0000, Charly Bechara wrote:
> I am investigating the boot process of the ARM11 MPCore on the
> PB11MPCore (mach-realview) board.
>
> Initially, the start_kernel() function is executing on CPU0, it
> creates kernel_init thead which I assume it is also executing on CPU0
> or am I wrong?

That's correct, it runs on CPU 0.

> When kernel_init thread executes, it calls smp_prepare_cpus() in
> arch/arm/mach-realview/platsmp.c code, where issupposed to start the
> secondary processors using secondary_startup() (head.S)

smp_prepare_cpus() calls poke_milo() which triggers the other CPUs to
execute realview_secondary_startup.

> After this stage, I am completely lost and I couldnt find any related
> documentation or understand the code :(

Maybe not that clear but it might help:

secondary_startup (in arch/arm/kernel/head.S) does a similar thing to
the initial CPU setup (stext in the same file), i.e. it looks up the
processor type and calls the processor initialisation function
(__v6_setup in arch/arm/mm/proc-v6.S). When returning from the setup
function, it gets into __enable_mmu followed by __turn_mmu_on. The
latter branches to __secondary_data_switch which branches to
secondary_start_kernel (in arch/arm/kernel/smp.c) after setting the
stack pointer to a thread structure allocated via cpu_up() called from
smp_init() called from kernel_init().

secondary_start_kernel (in arch/arm/kernel/smp.c) does some further
initialisation (local timers etc.) and calls cpu_idle() (not(e?) that
secondary_start_kernel is already considered a kernel thread as
described above). From this point, it is up to the scheduler to migrate
threads to the new CPUs since they are initially only executing the idle
task.

--
Catalin

沒有留言: