next up previous
Next: Scheduling Up: Changes To The Portable Previous: Changes To The Portable

Initialisation

The first problem with a multiprocessor kernel is starting the other processors up. Linux/SMP defines that a single processor enters the normal kernel entry point start_kernel(). Other processors are assumed not to be started or to have been captured elsewhere. The first processor begins the normal Linux initialisation sequences and sets up paging, interrupts and trap handlers. After it has obtained the processor information about the boot CPU, the architecture specific function

void smp_store_cpu_info(int processor_id)

is called to store any information about the processor into a per processor array. This includes things like the bogomips speed ratings.

Having completed the kernel initialisation the architecture specific function

void smp_boot_cpus(void)

is called and is expected to start up each other processor and cause it to enter start_kernel() with its paging registers and other control information correctly loaded. Each other processor skips the setup except for calling the trap and irq initialisation functions that are needed on some processors to set each CPU up correctly. These functions will probably need to be modified in existing kernels to cope with this.

Each additional CPU the calls the architecture specific function

void smp_callin(void)

which does any final setup and then spins the processor while the boot up processor forks off enough idle threads for each processor. This is necessary because the scheduler assumes there is always something to run. Having generated these threads and forked init the architecture specific

void smp_commence(void)

function is invoked. This does any final setup and indicates to the system that multiprocessor mode is now active. All the processors spinning in the smp_callin() function are now released to run the idle processes, which they will run when they have no real work to process.



nashif@rz.uni-mannheim.de
Tue May 28 14:38:25 PST 1996