From owner-svn-src-stable-11@freebsd.org Sat Jul 4 08:36:07 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52D60365A59; Sat, 4 Jul 2020 08:36:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49zQCW1VFWz4Md7; Sat, 4 Jul 2020 08:36:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15DAB19C9A; Sat, 4 Jul 2020 08:36:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0648a6rQ007613; Sat, 4 Jul 2020 08:36:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0648a66x007612; Sat, 4 Jul 2020 08:36:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202007040836.0648a66x007612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 4 Jul 2020 08:36:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r362927 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 362927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2020 08:36:07 -0000 Author: kib Date: Sat Jul 4 08:36:06 2020 New Revision: 362927 URL: https://svnweb.freebsd.org/changeset/base/362927 Log: MFC r362706: amd64 pmap: explain ptepindex. Modified: stable/11/sys/amd64/amd64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Sat Jul 4 08:34:43 2020 (r362926) +++ stable/11/sys/amd64/amd64/pmap.c Sat Jul 4 08:36:06 2020 (r362927) @@ -2754,6 +2754,29 @@ pmap_pinit(pmap_t pmap) * one or two pages may be held during the wait, only to be released * afterwards. This conservative approach is easily argued to avoid * race conditions. + * + * The ptepindexes, i.e. page indices, of the page table pages encountered + * while translating virtual address va are defined as follows: + * - for the page table page (last level), + * ptepindex = pmap_pde_pindex(va) = va >> PDRSHIFT, + * in other words, it is just the index of the PDE that maps the page + * table page. + * - for the page directory page, + * ptepindex = NUPDE (number of userland PD entries) + + * (pmap_pde_index(va) >> NPDEPGSHIFT) + * i.e. index of PDPE is put after the last index of PDE, + * - for the page directory pointer page, + * ptepindex = NUPDE + NUPDPE + (pmap_pde_index(va) >> (NPDEPGSHIFT + + * NPML4EPGSHIFT), + * i.e. index of pml4e is put after the last index of PDPE. + * + * Define an order on the paging entries, where all entries of the + * same height are put together, then heights are put from deepest to + * root. Then ptexpindex is the sequential number of the + * corresponding paging entry in this order. + * + * The root page at PML4 does not participate in this indexing scheme, since + * it is statically allocated by pmap_pinit() and not by _pmap_allocpte(). */ static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)