From owner-svn-src-head@freebsd.org Tue Sep 3 14:06:45 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 7BED7DCEBC; Tue, 3 Sep 2019 14:06:45 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7zn0XqGz4Ps5; Tue, 3 Sep 2019 14:06:45 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 5D4661AAF6; Tue, 3 Sep 2019 14:06:16 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id ECCBDC45D; Fri, 12 Apr 2019 00:53:35 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37B9D850F8; Fri, 12 Apr 2019 00:53:35 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0C8AEC437; Fri, 12 Apr 2019 00:53:35 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 3ECD1C435 for ; Fri, 12 Apr 2019 00:53:32 +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 0AE05850F4; Fri, 12 Apr 2019 00:53:32 +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 D528A1A24C; Fri, 12 Apr 2019 00:53:31 +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 x3C0rVru048936; Fri, 12 Apr 2019 00:53:31 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3C0rVj7048933; Fri, 12 Apr 2019 00:53:31 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201904120053.x3C0rVj7048933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346144 - in head/sys/powerpc: include powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: include powerpc X-SVN-Commit-Revision: 346144 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 37B9D850F8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.93)[-0.925,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Status: O X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:06:45 -0000 X-Original-Date: Fri, 12 Apr 2019 00:53:31 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:06:45 -0000 Author: jhibbits Date: Fri Apr 12 00:53:30 2019 New Revision: 346144 URL: https://svnweb.freebsd.org/changeset/base/346144 Log: powerpc: Adjust priority NOPs, and make them functions PowerISA 2.07 and PowerISA 3.0 both specify special NOPs for priority adjustments, with "medium" priority being normal. We had been setting medium-low as our normal priority. Rather than guess each time as to what we want and the right NOP, wrap them in inline functions, and replace the occurrances of the NOPs with the functions. Also, make DELAY() drop to very low priority while waiting, so we don't burn CPU. Coupled with r346143, this shaves off a modest 5-8% on buildworld times with -j72. There may be more room for improvement with judicious use of these NOPs. MFC after: 2 weeks Modified: head/sys/powerpc/include/cpufunc.h head/sys/powerpc/powerpc/machdep.c head/sys/powerpc/powerpc/mp_machdep.c Modified: head/sys/powerpc/include/cpufunc.h ============================================================================== --- head/sys/powerpc/include/cpufunc.h Fri Apr 12 00:44:33 2019 (r346143) +++ head/sys/powerpc/include/cpufunc.h Fri Apr 12 00:53:30 2019 (r346144) @@ -212,6 +212,43 @@ get_pcpu(void) return (ret); } +/* "NOP" operations to signify priorities to the kernel. */ +static __inline void +nop_prio_vlow(void) +{ + __asm __volatile("or 31,31,31"); +} + +static __inline void +nop_prio_low(void) +{ + __asm __volatile("or 1,1,1"); +} + +static __inline void +nop_prio_mlow(void) +{ + __asm __volatile("or 6,6,6"); +} + +static __inline void +nop_prio_medium(void) +{ + __asm __volatile("or 2,2,2"); +} + +static __inline void +nop_prio_mhigh(void) +{ + __asm __volatile("or 5,5,5"); +} + +static __inline void +nop_prio_high(void) +{ + __asm __volatile("or 3,3,3"); +} + #endif /* _KERNEL */ #endif /* !_MACHINE_CPUFUNC_H_ */ Modified: head/sys/powerpc/powerpc/machdep.c ============================================================================== --- head/sys/powerpc/powerpc/machdep.c Fri Apr 12 00:44:33 2019 (r346143) +++ head/sys/powerpc/powerpc/machdep.c Fri Apr 12 00:53:30 2019 (r346144) @@ -494,7 +494,7 @@ spinlock_enter(void) td = curthread; if (td->td_md.md_spinlock_count == 0) { - __asm __volatile("or 2,2,2"); /* Set high thread priority */ + nop_prio_mhigh(); msr = intr_disable(); td->td_md.md_spinlock_count = 1; td->td_md.md_saved_msr = msr; @@ -515,7 +515,7 @@ spinlock_exit(void) td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) { intr_restore(msr); - __asm __volatile("or 6,6,6"); /* Set normal thread priority */ + nop_prio_medium(); } } Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Fri Apr 12 00:44:33 2019 (r346143) +++ head/sys/powerpc/powerpc/mp_machdep.c Fri Apr 12 00:53:30 2019 (r346144) @@ -78,8 +78,8 @@ machdep_ap_bootstrap(void) __asm __volatile("msync; isync"); while (ap_letgo == 0) - __asm __volatile("or 31,31,31"); - __asm __volatile("or 6,6,6"); + nop_prio_vlow(); + nop_prio_medium(); /* * Set timebase as soon as possible to meet an implicit rendezvous