From owner-svn-src-head@freebsd.org Thu Jul 25 03:47:29 2019 Return-Path: Delivered-To: svn-src-head@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 523D1C1C4A; Thu, 25 Jul 2019 03:47:29 +0000 (UTC) (envelope-from jhibbits@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) server-signature RSA-PSS (4096 bits) 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 0CF598CA17; Thu, 25 Jul 2019 03:47:29 +0000 (UTC) (envelope-from jhibbits@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 96A5F20DDB; Thu, 25 Jul 2019 03:47:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6P3lSUZ006283; Thu, 25 Jul 2019 03:47:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6P3lRpT006278; Thu, 25 Jul 2019 03:47:27 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907250347.x6P3lRpT006278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 25 Jul 2019 03:47:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350313 - in head/sys: conf powerpc/aim powerpc/ps3 powerpc/pseries X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: conf powerpc/aim powerpc/ps3 powerpc/pseries X-SVN-Commit-Revision: 350313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0CF598CA17 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.941,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jul 2019 03:47:29 -0000 Author: jhibbits Date: Thu Jul 25 03:47:27 2019 New Revision: 350313 URL: https://svnweb.freebsd.org/changeset/base/350313 Log: powerpc/pmap64: Make moea64 statistics optional Summary: It turns out statistics accounting is very expensive in the pmap driver, and doesn't seem necessary in the common case. Make this optional behind a MOEA64_STATS #define, which one can set if they really need statistics. This saves ~7-8% on buildworld time on a POWER9. Found by bdragon. Reviewed by: luporl Differential Revision: https://reviews.freebsd.org/D20903 Modified: head/sys/conf/options.powerpc head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/mmu_oea64.h head/sys/powerpc/aim/moea64_native.c head/sys/powerpc/ps3/mmu_ps3.c head/sys/powerpc/pseries/mmu_phyp.c Modified: head/sys/conf/options.powerpc ============================================================================== --- head/sys/conf/options.powerpc Thu Jul 25 00:07:10 2019 (r350312) +++ head/sys/conf/options.powerpc Thu Jul 25 03:47:27 2019 (r350313) @@ -19,6 +19,7 @@ GFB_DEBUG opt_gfb.h GFB_NO_FONT_LOADING opt_gfb.h GFB_NO_MODE_CHANGE opt_gfb.h +MOEA64_STATS opt_pmap.h MPC85XX opt_platform.h POWERMAC opt_platform.h PS3 opt_platform.h Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Thu Jul 25 00:07:10 2019 (r350312) +++ head/sys/powerpc/aim/mmu_oea64.c Thu Jul 25 03:47:27 2019 (r350313) @@ -200,6 +200,7 @@ static u_int moea64_vsid_bitmap[NVSIDS / VSID_NBPW]; static boolean_t moea64_initialized = FALSE; +#ifdef MOEA64_STATS /* * Statistics. */ @@ -218,6 +219,7 @@ SYSCTL_INT(_machdep, OID_AUTO, moea64_pvo_enter_calls, &moea64_pvo_enter_calls, 0, ""); SYSCTL_INT(_machdep, OID_AUTO, moea64_pvo_remove_calls, CTLFLAG_RD, &moea64_pvo_remove_calls, 0, ""); +#endif vm_offset_t moea64_scratchpage_va[2]; struct pvo_entry *moea64_scratchpage_pvo[2]; @@ -1434,7 +1436,7 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v /* If not in page table, reinsert it */ if (MOEA64_PTE_SYNCH(mmu, oldpvo) < 0) { - moea64_pte_overflow--; + STAT_MOEA64(moea64_pte_overflow--); MOEA64_PTE_INSERT(mmu, oldpvo); } @@ -2522,7 +2524,7 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, str PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED); - moea64_pvo_enter_calls++; + STAT_MOEA64(moea64_pvo_enter_calls++); /* * Add to pmap list @@ -2557,7 +2559,7 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, str panic("moea64_pvo_enter: overflow"); } - moea64_pvo_entries++; + STAT_MOEA64(moea64_pvo_entries++); if (pvo->pvo_pmap == kernel_pmap) isync(); @@ -2656,8 +2658,8 @@ moea64_pvo_remove_from_page_locked(mmu_t mmu, struct p } } - moea64_pvo_entries--; - moea64_pvo_remove_calls++; + STAT_MOEA64(moea64_pvo_entries--); + STAT_MOEA64(moea64_pvo_remove_calls++); } static void Modified: head/sys/powerpc/aim/mmu_oea64.h ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.h Thu Jul 25 00:07:10 2019 (r350312) +++ head/sys/powerpc/aim/mmu_oea64.h Thu Jul 25 03:47:27 2019 (r350313) @@ -30,6 +30,8 @@ #ifndef _POWERPC_AIM_MMU_OEA64_H #define _POWERPC_AIM_MMU_OEA64_H +#include "opt_pmap.h" + #include extern mmu_def_t oea64_mmu; @@ -72,8 +74,13 @@ void moea64_late_bootstrap(mmu_t mmup, vm_offset_t ke * Statistics */ +#ifdef MOEA64_STATS extern u_int moea64_pte_valid; extern u_int moea64_pte_overflow; +#define STAT_MOEA64(x) x +#else +#define STAT_MOEA64(x) ((void)0) +#endif /* * State variables Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Thu Jul 25 00:07:10 2019 (r350312) +++ head/sys/powerpc/aim/moea64_native.c Thu Jul 25 03:47:27 2019 (r350313) @@ -332,7 +332,7 @@ moea64_pte_unset_native(mmu_t mmu, struct pvo_entry *p if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) != (properpt.pte_hi & LPTE_AVPN_MASK)) { /* Evicted */ - moea64_pte_overflow--; + STAT_MOEA64(moea64_pte_overflow--); rw_runlock(&moea64_eviction_lock); return (-1); } @@ -352,7 +352,7 @@ moea64_pte_unset_native(mmu_t mmu, struct pvo_entry *p rw_runlock(&moea64_eviction_lock); /* Keep statistics */ - moea64_pte_valid--; + STAT_MOEA64(moea64_pte_valid--); return (ptelo & (LPTE_CHG | LPTE_REF)); } @@ -656,8 +656,8 @@ moea64_insert_to_pteg_native(struct lpte *pvo_pt, uint (ADDR_API_SHFT64 - ADDR_PIDX_SHFT); PTESYNC(); TLBIE(va); - moea64_pte_valid--; - moea64_pte_overflow++; + STAT_MOEA64(moea64_pte_valid--); + STAT_MOEA64(moea64_pte_overflow++); } /* @@ -670,7 +670,7 @@ moea64_insert_to_pteg_native(struct lpte *pvo_pt, uint PTESYNC(); /* Keep statistics */ - moea64_pte_valid++; + STAT_MOEA64(moea64_pte_valid++); return (k); } Modified: head/sys/powerpc/ps3/mmu_ps3.c ============================================================================== --- head/sys/powerpc/ps3/mmu_ps3.c Thu Jul 25 00:07:10 2019 (r350312) +++ head/sys/powerpc/ps3/mmu_ps3.c Thu Jul 25 03:47:27 2019 (r350313) @@ -224,14 +224,14 @@ mps3_pte_unset(mmu_t mmu, struct pvo_entry *pvo) mtx_lock(&mps3_table_lock); refchg = mps3_pte_synch_locked(pvo); if (refchg < 0) { - moea64_pte_overflow--; + STAT_MOEA64(moea64_pte_overflow--); mtx_unlock(&mps3_table_lock); return (-1); } /* XXX: race on RC bits between unset and sync. Anything to do? */ lv1_write_htab_entry(mps3_vas_id, pvo->pvo_pte.slot, 0, 0); mtx_unlock(&mps3_table_lock); - moea64_pte_valid--; + STAT_MOEA64(moea64_pte_valid--); return (refchg & (LPTE_REF | LPTE_CHG)); } @@ -272,13 +272,13 @@ mps3_pte_insert(mmu_t mmu, struct pvo_entry *pvo) pvo->pvo_vaddr |= PVO_HID; pvo->pvo_pte.slot = index; - moea64_pte_valid++; + STAT_MOEA64(moea64_pte_valid++); if (evicted.pte_hi) { KASSERT((evicted.pte_hi & (LPTE_WIRED | LPTE_LOCKED)) == 0, ("Evicted a wired PTE")); - moea64_pte_valid--; - moea64_pte_overflow++; + STAT_MOEA64(moea64_pte_valid--); + STAT_MOEA64(moea64_pte_overflow++); } return (0); Modified: head/sys/powerpc/pseries/mmu_phyp.c ============================================================================== --- head/sys/powerpc/pseries/mmu_phyp.c Thu Jul 25 00:07:10 2019 (r350312) +++ head/sys/powerpc/pseries/mmu_phyp.c Thu Jul 25 03:47:27 2019 (r350313) @@ -364,7 +364,7 @@ mphyp_pte_unset(mmu_t mmu, struct pvo_entry *pvo) ("Error removing page: %d", err)); if (err == H_NOT_FOUND) { - moea64_pte_overflow--; + STAT_MOEA64(moea64_pte_overflow--); return (-1); } @@ -485,7 +485,7 @@ mphyp_pte_insert(mmu_t mmu, struct pvo_entry *pvo) result = phyp_pft_hcall(H_REMOVE, H_AVPN, index, evicted.pte_hi & LPTE_AVPN_MASK, 0, &junk, &lastptelo, &junk); - moea64_pte_overflow++; + STAT_MOEA64(moea64_pte_overflow++); KASSERT(result == H_SUCCESS || result == H_NOT_FOUND, ("Error evicting page: %d", (int)result)); }