Code review: groundwork for SMP
neelnatu at gmail.com
Thu Jan 28 22:28:24 UTC 2010
Forwarding to freebsd-mips as suggested by Warner.
This is a patch to provide access to pcpu structures for SMP kernels.
The basic idea is to use a the same virtual address as a window onto
distinct physical memory locations - one per processor. The physical
address that you access through this mapping depends on which cpu you
are currently executing on. We can now use the virtual address on any
processor to access its per-cpu area.
The details are:
1. The virtual address for 'struct pcpu *pcpup' is obtained by
stealing 2 pages worth of KVA in pmap_bootstrap().
2. The mapping from the constant virtual address to a distinct
physical page is done in cpu_pcpu_init() through a wired TLB entry.
3. A side-effect of this is that we reserve 2 pages worth of memory
for the pcpu but in reality it needs much less than that. The unused
memory is now used as the boot stack for the BSP and APs.
I also cleaned up locore.S to remove the SMP-specific bits from it. I
plan to use a separate mpboot.S for the AP bootstrap.
The patch is available here:
More information about the freebsd-mips