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
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
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
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.