Subject: Re: Recursive PT mapping strangeness?
To: None <thorpej@wasabisystems.com, port-arm@netbsd.org>
From: Chris Gilbert <chris@paradox.demon.co.uk>
List: port-arm
Date: 02/06/2002 10:52:07
On Wednesday 06 February 2002 5:09 am, Jason R Thorpe wrote:
> On Tue, Feb 05, 2002 at 07:44:27PM -0800, Jason R Thorpe wrote:
> > This says to me that the recursive PT mapping is somehow screwed up.
> >
> > Now, for recursive PT mappings to work properly, both the L1 and L2
> > descriptors must have the same format. This is not generally the case
> > with ARM PTEs.
>
> Yah, and after discussing this w/ Bill Sommerfeld, he set me straight
> and I now have my head wrapped around the non-recursive PT mapping used
> by the ARM pmap (sigh, I have been working on this code too long; my
> eyes are starting to glaze over).
>
> That still doesn't change my puzzlement with what's going on with the
> mdpage change...
I've not had time to look in depth, so this could be completly clutching at
straws. but there's a difference in the way vm_pages are allocated:
freepages = 0;
for (lcv = 0 ; lcv < vm_nphysseg ; lcv++)
freepages += (vm_physmem[lcv].end - vm_physmem[lcv].start);
[snip]
pagecount = ((freepages + 1) << PAGE_SHIFT) /
(PAGE_SIZE + sizeof(struct vm_page));
If I read the above it doesn't actually give a vm_page for every page of
memory, compare that with how the pv_heads were allocated:
{
int npages, lcv;
vsize_t s;
npages = 0;
for (lcv = 0 ; lcv < vm_nphysseg ; lcv++)
npages += (vm_physmem[lcv].end - vm_physmem[lcv].start);
s = (vsize_t) (sizeof(struct pv_head) * npages +
sizeof(char) * npages);
s = round_page(s); /* round up */
boot_head = (char *)uvm_pageboot_alloc(s);
bzero((char *)boot_head, s);
if (boot_head == 0)
panic("pmap_init: unable to allocate pv_heads");
}
Note that it doesn't do the strange bit of maths. it even uses pv_heads on
its own memory.
Quick check with some maths:
say we've got 8192 pages, that's about 32MB. In the old style you got 8192
pv_heads, with the new style you get 8168 vm_pages, because I guess we don't
need vm_pages to manage where the vm_pages were allocated? but I'm wondering
if we do need pv_heads for them?
Note I'm quite possibly wrong though. I'll try to find time this evening to
play with the code.
Chris