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.
This commit is contained in:
Justin Hibbits 2019-03-26 02:53:35 +00:00
parent dc4636133f
commit 9f1a007da7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345520

View File

@ -146,17 +146,18 @@ 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__
/*
@ -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;
}