tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: x86: move the LAPIC va



On Sat, Oct 08, 2016 at 05:14:43PM +0200, Maxime Villard wrote:
> On x86 there's a set of memory-mapped registers that are per-cpu and called 
> the
> LAPIC. They reside at a fixed one-page-sized physical address, and in order 
> to
> read or write to them the kernel has to allocate a virtual address and then
> kenter it to the aforementioned physical one.
> 
> In the NetBSD kernel, however, we do something a little bizarre: instead of
> following this model, the kernel has a blank page at the beginning of the 
> data
> segment, and it then directly kenters the va of this page into the LAPIC pa.
> 
> The issue with this design is that it implies the first page of .data does 
> not
> actually belong to .data, and therefore it is not possible to map the 
> beginning
> of .data with large pages. In addition to this, without going into useless
> details, it creates an inconsistency in the low memory map, because the 
> pa<->va
> translation is not linear, even if it seemingly is harmless.

If you are going to change it, why not pick a more appropriate fixed virtual
address?
The smp code will already be using one for things like curproc.
That way you don't need to add all the indirections to the asm code
and don't need asm #defines that use temporary registers.
You'll still need a physica page for non LAPIC cpu (probably
not smp-capable designs).

	David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index