From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 4 20:08:33 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA25E1065677 for ; Wed, 4 Apr 2012 20:08:33 +0000 (UTC) (envelope-from vasanth.raonaik@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 37DC98FC23 for ; Wed, 4 Apr 2012 20:08:33 +0000 (UTC) Received: by wgbds12 with SMTP id ds12so641434wgb.31 for ; Wed, 04 Apr 2012 13:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=pU6Kpfv5eb9JFCwmqc5+5ccnHPmyceYC8Dwsi59HrKg=; b=wUqsdyY9UYNOxJOZ++aqnVgEfzzXA77mXajiwHTP8VE1HCQ3+TFfpjMX0o5bfJ4SUH N9fGUVoduelhBLI87Lhf4el5oaa8PLpOWh9lFDM+WzG9s/804bw8RmWuEF7YSsVfRDO+ cFxWVKhd7N+/S8WWxQHKhcr1dYBuWnAsqgc9Ikk3qtHVXI2mnbimNcMA1lL6bhRZLjAe QwoOS7Cdfue8nUvM1XK9u3roLEFL9GPJzonSss+J4+VdvTd/14GdIQaAiAsd0FrJ23J4 uzvDMRTfCSb7Z6icyurA59p4b6Cds1BK5s04/wVJNplUBMRe4xGJUJdH86zMqFuA82ix 4zbg== MIME-Version: 1.0 Received: by 10.216.132.40 with SMTP id n40mr2205844wei.68.1333570112066; Wed, 04 Apr 2012 13:08:32 -0700 (PDT) Received: by 10.180.98.161 with HTTP; Wed, 4 Apr 2012 13:08:32 -0700 (PDT) In-Reply-To: References: Date: Wed, 4 Apr 2012 16:08:32 -0400 Message-ID: From: vasanth rao naik sabavat To: Mark Tinguely Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: question about amd64 pagetable page allocation. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2012 20:08:33 -0000 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 wrote: > On Tue, Apr 3, 2012 at 1:52 PM, vasanth rao naik sabavat > 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. >