From owner-svn-src-all@freebsd.org Wed Aug 8 17:12:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40BA31062D62; Wed, 8 Aug 2018 17:12:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB50D86C80; Wed, 8 Aug 2018 17:12:06 +0000 (UTC) (envelope-from markj@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 CE04458F0; Wed, 8 Aug 2018 17:12:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w78HC6n0088786; Wed, 8 Aug 2018 17:12:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w78HC62C088785; Wed, 8 Aug 2018 17:12:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201808081712.w78HC62C088785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 8 Aug 2018 17:12: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: r337466 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/arm64/arm64 X-SVN-Commit-Revision: 337466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2018 17:12:07 -0000 Author: markj Date: Wed Aug 8 17:12:06 2018 New Revision: 337466 URL: https://svnweb.freebsd.org/changeset/base/337466 Log: MFC r336714: Simplify the arm64 implementation of pmap_mincore(). Modified: stable/11/sys/arm64/arm64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Wed Aug 8 17:11:07 2018 (r337465) +++ stable/11/sys/arm64/arm64/pmap.c Wed Aug 8 17:12:06 2018 (r337466) @@ -4683,76 +4683,45 @@ pmap_demote_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ int pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) { - pd_entry_t *l1p, l1; - pd_entry_t *l2p, l2; - pt_entry_t *l3p, l3; - vm_paddr_t pa; + pt_entry_t *pte, tpte; + vm_paddr_t mask, pa; + int lvl, val; bool managed; - int val; PMAP_LOCK(pmap); retry: - pa = 0; val = 0; - managed = false; + pte = pmap_pte(pmap, addr, &lvl); + if (pte != NULL) { + tpte = pmap_load(pte); - l1p = pmap_l1(pmap, addr); - if (l1p == NULL) /* No l1 */ - goto done; + switch (lvl) { + case 3: + mask = L3_OFFSET; + break; + case 2: + mask = L2_OFFSET; + break; + case 1: + mask = L1_OFFSET; + break; + default: + panic("pmap_mincore: invalid level %d", lvl); + } - l1 = pmap_load(l1p); - if ((l1 & ATTR_DESCR_MASK) == L1_INVAL) - goto done; - - if ((l1 & ATTR_DESCR_MASK) == L1_BLOCK) { - pa = (l1 & ~ATTR_MASK) | (addr & L1_OFFSET); - managed = (l1 & ATTR_SW_MANAGED) == ATTR_SW_MANAGED; - val = MINCORE_SUPER | MINCORE_INCORE; - if (pmap_page_dirty(l1)) - val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; - if ((l1 & ATTR_AF) == ATTR_AF) - val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; - goto done; - } - - l2p = pmap_l1_to_l2(l1p, addr); - if (l2p == NULL) /* No l2 */ - goto done; - - l2 = pmap_load(l2p); - if ((l2 & ATTR_DESCR_MASK) == L2_INVAL) - goto done; - - if ((l2 & ATTR_DESCR_MASK) == L2_BLOCK) { - pa = (l2 & ~ATTR_MASK) | (addr & L2_OFFSET); - managed = (l2 & ATTR_SW_MANAGED) == ATTR_SW_MANAGED; - val = MINCORE_SUPER | MINCORE_INCORE; - if (pmap_page_dirty(l2)) - val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; - if ((l2 & ATTR_AF) == ATTR_AF) - val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; - goto done; - } - - l3p = pmap_l2_to_l3(l2p, addr); - if (l3p == NULL) /* No l3 */ - goto done; - - l3 = pmap_load(l2p); - if ((l3 & ATTR_DESCR_MASK) == L3_INVAL) - goto done; - - if ((l3 & ATTR_DESCR_MASK) == L3_PAGE) { - pa = (l3 & ~ATTR_MASK) | (addr & L3_OFFSET); - managed = (l3 & ATTR_SW_MANAGED) == ATTR_SW_MANAGED; val = MINCORE_INCORE; - if (pmap_page_dirty(l3)) + if (lvl != 3) + val |= MINCORE_SUPER; + if (pmap_page_dirty(tpte)) val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; - if ((l3 & ATTR_AF) == ATTR_AF) + if ((tpte & ATTR_AF) == ATTR_AF) val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; - } -done: + managed = (tpte & ATTR_SW_MANAGED) == ATTR_SW_MANAGED; + pa = (tpte & ~ATTR_MASK) | (addr & mask); + } else + managed = false; + if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && managed) { /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */