Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 2010 14:01:40 -0800
From:      Neel Natu <neelnatu@gmail.com>
To:        freebsd-mips@freebsd.org
Subject:   Code review: groundwork for SMP
Message-ID:  <dffe84831001281401n7c9fb64bjb38260943448f315@mail.gmail.com>
In-Reply-To: <20100128.132114.1004138037722505681.imp@bsdimp.com>
References:  <dffe84831001262336l1978797g8b12fab815f4eb52@mail.gmail.com> <20100128.132114.1004138037722505681.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

Please review.

The patch is available here:
http://people.freebsd.org/~neel/smp_groundwork.diff

best
Neel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?dffe84831001281401n7c9fb64bjb38260943448f315>