svn commit: r345520 - head/sys/powerpc/aim
Justin Hibbits
jhibbits at FreeBSD.org
Tue Mar 26 02:53:36 UTC 2019
Author: jhibbits
Date: Tue Mar 26 02:53:35 2019
New Revision: 345520
URL: https://svnweb.freebsd.org/changeset/base/345520
Log:
powerpc64: Micro-optimize moea64 native pmap tlbie
* Cache moea64_need_lock in a local variable; gcc generates slightly better
code this way, it doesn't need to reload the value from memory each read.
* VPN cropping is only needed on PowerPC ISA 2.02 and older cores, a subset
of those that need serialization, so move this under the need_lock check,
so those that don't need the lock don't even need to check this.
Modified:
head/sys/powerpc/aim/moea64_native.c
Modified: head/sys/powerpc/aim/moea64_native.c
==============================================================================
--- head/sys/powerpc/aim/moea64_native.c Tue Mar 26 02:45:23 2019 (r345519)
+++ head/sys/powerpc/aim/moea64_native.c Tue Mar 26 02:53:35 2019 (r345520)
@@ -146,18 +146,19 @@ TLBIE(uint64_t vpn) {
#endif
static volatile u_int tlbie_lock = 0;
+ bool need_lock = moea64_need_lock;
vpn <<= ADDR_PIDX_SHFT;
/* Hobo spinlock: we need stronger guarantees than mutexes provide */
- if (moea64_need_lock) {
+ if (need_lock) {
while (!atomic_cmpset_int(&tlbie_lock, 0, 1));
isync(); /* Flush instruction queue once lock acquired */
+
+ if (moea64_crop_tlbie)
+ vpn &= ~(0xffffULL << 48);
}
- if (moea64_crop_tlbie)
- vpn &= ~(0xffffULL << 48);
-
#ifdef __powerpc64__
/*
* Explicitly clobber r0. The tlbie instruction has two forms: an old
@@ -196,7 +197,7 @@ TLBIE(uint64_t vpn) {
#endif
/* No barriers or special ops -- taken care of by ptesync above */
- if (moea64_need_lock)
+ if (need_lock)
tlbie_lock = 0;
}
More information about the svn-src-head
mailing list