Date: Sun, 8 Dec 2019 04:17:04 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355519 - head/sys/powerpc/aim Message-ID: <201912080417.xB84H4RX011159@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Sun Dec 8 04:17:04 2019 New Revision: 355519 URL: https://svnweb.freebsd.org/changeset/base/355519 Log: powerpc64/pmap: micro-optimize some PVO-PTE logic Summary: moea64_pte_sync_native() and moea64_pte_unset_native() don't need the full PTE created, they only need to check that the PVO has a matching PTE to the PTE in the page table. Don't waste time creating the full PTE in this case. Reviewed by: luporl Differential Revision: https://reviews.freebsd.org/D22341 Modified: head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/mmu_oea64.h head/sys/powerpc/aim/moea64_native.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sun Dec 8 02:11:06 2019 (r355518) +++ head/sys/powerpc/aim/mmu_oea64.c Sun Dec 8 04:17:04 2019 (r355519) @@ -435,8 +435,7 @@ void moea64_pte_from_pvo(const struct pvo_entry *pvo, struct lpte *lpte) { - lpte->pte_hi = (pvo->pvo_vpn >> (ADDR_API_SHFT64 - ADDR_PIDX_SHFT)) & - LPTE_AVPN_MASK; + lpte->pte_hi = moea64_pte_vpn_from_pvo_vpn(pvo); lpte->pte_hi |= LPTE_VALID; if (pvo->pvo_vaddr & PVO_LARGE) Modified: head/sys/powerpc/aim/mmu_oea64.h ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.h Sun Dec 8 02:11:06 2019 (r355518) +++ head/sys/powerpc/aim/mmu_oea64.h Sun Dec 8 04:17:04 2019 (r355519) @@ -76,6 +76,13 @@ void moea64_mid_bootstrap(mmu_t mmup, vm_offset_t ker void moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend); +static inline uint64_t +moea64_pte_vpn_from_pvo_vpn(const struct pvo_entry *pvo) +{ + return ((pvo->pvo_vpn >> (ADDR_API_SHFT64 - ADDR_PIDX_SHFT)) & + LPTE_AVPN_MASK); +} + /* * Statistics */ Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Sun Dec 8 02:11:06 2019 (r355518) +++ head/sys/powerpc/aim/moea64_native.c Sun Dec 8 04:17:04 2019 (r355519) @@ -257,16 +257,14 @@ static int64_t moea64_pte_synch_native(mmu_t mmu, struct pvo_entry *pvo) { volatile struct lpte *pt = moea64_pteg_table + pvo->pvo_pte.slot; - struct lpte properpt; - uint64_t ptelo; + uint64_t ptelo, pvo_ptevpn; PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED); - moea64_pte_from_pvo(pvo, &properpt); + pvo_ptevpn = moea64_pte_vpn_from_pvo_vpn(pvo); rw_rlock(&moea64_eviction_lock); - if ((be64toh(pt->pte_hi) & LPTE_AVPN_MASK) != - (properpt.pte_hi & LPTE_AVPN_MASK)) { + if ((be64toh(pt->pte_hi) & LPTE_AVPN_MASK) != pvo_ptevpn) { /* Evicted */ rw_runlock(&moea64_eviction_lock); return (-1); @@ -330,14 +328,12 @@ static int64_t moea64_pte_unset_native(mmu_t mmu, struct pvo_entry *pvo) { volatile struct lpte *pt = moea64_pteg_table + pvo->pvo_pte.slot; - struct lpte properpt; - uint64_t ptelo; + uint64_t ptelo, pvo_ptevpn; - moea64_pte_from_pvo(pvo, &properpt); + pvo_ptevpn = moea64_pte_vpn_from_pvo_vpn(pvo); rw_rlock(&moea64_eviction_lock); - if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) != - (properpt.pte_hi & LPTE_AVPN_MASK)) { + if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) != pvo_ptevpn) { /* Evicted */ STAT_MOEA64(moea64_pte_overflow--); rw_runlock(&moea64_eviction_lock);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912080417.xB84H4RX011159>