Date: Tue, 8 Sep 2015 18:41:06 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287570 - head/sys/arm64/arm64 Message-ID: <201509081841.t88If7G1033364@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Tue Sep 8 18:41:06 2015 New Revision: 287570 URL: https://svnweb.freebsd.org/changeset/base/287570 Log: Add support for pmap_mincore on arm64 by walking the page tables to find the details for the requested address. PR: 202307 Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Sep 8 18:37:16 2015 (r287569) +++ head/sys/arm64/arm64/pmap.c Tue Sep 8 18:41:06 2015 (r287570) @@ -3032,8 +3032,74 @@ pmap_page_set_memattr(vm_page_t m, vm_me 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; + bool managed; + int val; + + PMAP_LOCK(pmap); +retry: + pa = 0; + val = 0; + managed = false; + + l1p = pmap_l1(pmap, addr); + if (l1p == NULL) /* No l1 */ + goto done; + l1 = pmap_load(l1p); + 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_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_PAGE) { + pa = (l3 & ~ATTR_MASK) | (addr & L3_OFFSET); + managed = (l3 & ATTR_SW_MANAGED) == ATTR_SW_MANAGED; + val = MINCORE_INCORE; + if (pmap_page_dirty(l3)) + val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; + if ((l3 & ATTR_AF) == ATTR_AF) + val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; + } + +done: + 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. */ + if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) + goto retry; + } else + PA_UNLOCK_COND(*locked_pa); + PMAP_UNLOCK(pmap); - panic("ARM64TODO: pmap_mincore"); + return (val); } void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509081841.t88If7G1033364>