Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Apr 2012 16:08:32 -0400
From:      vasanth rao naik sabavat <vasanth.raonaik@gmail.com>
To:        Mark Tinguely <marktinguely@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: question about amd64 pagetable page allocation.
Message-ID:  <CAAuizBhRcXh2t--Po=rrRzvjsP6xJyBD0stVnMXkv2zx2sfC2w@mail.gmail.com>
In-Reply-To: <CAP%2BM-_F5GPO25CURVYV_V1nX1Ua=O2A_%2B0Th%2BtDZXC8wVjr76g@mail.gmail.com>
References:  <CAAuizBhUuWvbYjZewO5LgHPuGfi37mW0sJFAKs-YN-G1ZbNAUQ@mail.gmail.com> <CAP%2BM-_Es5A3a0%2BcM6K=qi_kbk0ftnHHmZoazuerhg3TxrVr6SA@mail.gmail.com> <CAAuizBh0M_wpUvWU%2B0-CMC9XveqQNXOqtB92NhABnGGUVuq4DQ@mail.gmail.com> <CAP%2BM-_E%2BwsDRPd6JiO4M-MEsYERnGcA-oR-ckWAeEE7kWwrfmw@mail.gmail.com> <CAAuizBgAPu9n=gAubVZXxdyboaH1BT_sxQu-jAJB1QSpbn%2BO4g@mail.gmail.com> <CAP%2BM-_F5GPO25CURVYV_V1nX1Ua=O2A_%2B0Th%2BtDZXC8wVjr76g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello Mark,

>From what I understand, the virtual address of a given page table should
not change when accessing from vtopte() and pmap_pte().

However, with small code change in pmap_remove_pages(), I was able to print
the values returned by these two functions.

vtopte() and pmap_pte(),

pte1 0xffff8000006432e0 pa1 346941425 m1 0xffffff04291cf600, pte2
0xffffff03463032e0 pa2 346941425 m2 0xffffff04291cf600
pte1 0xffff8000006432e8 pa1 346842425 m1 0xffffff04291c7e78, pte2
0xffffff03463032e8 pa2 346842425 m2 0xffffff04291c7e78
pte1 0xffff8000006432f0 pa1 346863425 m1 0xffffff04291c8df0, pte2
0xffffff03463032f0 pa2 346863425 m2 0xffffff04291c8df0

In the above result, the pte1 is the result of vtopte() and pte2 is the
result of pmap_pte().

Interestingly, the value of these two virtual addresses pte1 and pte2,
result in the same physical address pa1 == pa2.

If I am not wrong, the page tables are now mapped in two different virtual
addresses?

Could you please clarify this?

Thanks,
Vasanth

On Tue, Apr 3, 2012 at 3:18 PM, Mark Tinguely <marktinguely@gmail.com>wrote:

> On Tue, Apr 3, 2012 at 1:52 PM, vasanth rao naik sabavat
> <vasanth.raonaik@gmail.com> wrote:
> > Hello Mark,
> >
> > I think pmap_remove_pages() is executed only for the current process.
> >
> >    2549 #ifdef PMAP_REMOVE_PAGES_CURPROC_ONLY
> >    2550     if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) {
> >    2551         printf("warning: pmap_remove_pages called with
> non-current
> > pmap\n");
> >    2552         return;
> >    2553     }
> >    2554 #endif
> >
> > I dont still get it why this was removed?
> >
> > Thanks,
> > Vasanth
>
>
> That is pretty old code. Newer code does not make that assumption.
>
> Without the assumption that the pages are from the current map, then you
> have to use the direct physical -> virtual mapping:
>
> 2547    #ifdef PMAP_REMOVE_PAGES_CURPROC_ONLY
> 2548    pte = vtopte(pv->pv_va);
> 2549    #else
> 2550    pte = pmap_pte(pmap, pv->pv_va);
> 2551    #endif
>
> --Mark Tinguely.
>



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