#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/lock.h>
-#include <sys/rwlock.h>
+#include <sys/rmlock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
extern int n_slbs;
-static struct rwlock mphyp_eviction_lock;
+static struct rmlock mphyp_eviction_lock;
/*
* Kernel MMU interface
phandle_t dev, node, root;
int idx, len, res;
- rw_init(&mphyp_eviction_lock, "pte eviction");
+ rm_init(&mphyp_eviction_lock, "pte eviction");
moea64_early_bootstrap(mmup, kernelstart, kernelend);
static int64_t
mphyp_pte_clear(mmu_t mmu, struct pvo_entry *pvo, uint64_t ptebit)
{
+ struct rm_priotracker track;
int64_t refchg;
uint64_t ptelo, junk;
int err;
* shared eviction lock.
*/
PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED);
- rw_rlock(&mphyp_eviction_lock);
+ rm_rlock(&mphyp_eviction_lock, &track);
refchg = mphyp_pte_synch(mmu, pvo);
if (refchg < 0) {
- rw_runlock(&mphyp_eviction_lock);
+ rm_runlock(&mphyp_eviction_lock, &track);
return (refchg);
}
* Pessimistically claim that, once modified, it stays so
* forever and that it is never referenced.
*/
- rw_runlock(&mphyp_eviction_lock);
+ rm_runlock(&mphyp_eviction_lock, &track);
return (refchg & ~LPTE_REF);
}
refchg |= (ptelo & LPTE_REF);
}
- rw_runlock(&mphyp_eviction_lock);
+ rm_runlock(&mphyp_eviction_lock, &track);
return (refchg);
}
static int
mphyp_pte_insert(mmu_t mmu, struct pvo_entry *pvo)
{
+ struct rm_priotracker track;
int64_t result;
struct lpte evicted, pte;
uint64_t index, junk, lastptelo;
evicted.pte_hi = 0;
/* Make sure further insertion is locked out during evictions */
- rw_rlock(&mphyp_eviction_lock);
+ rm_rlock(&mphyp_eviction_lock, &track);
/*
* First try primary hash.
result = phyp_pft_hcall(H_ENTER, 0, pvo->pvo_pte.slot, pte.pte_hi,
pte.pte_lo, &index, &evicted.pte_lo, &junk);
if (result == H_SUCCESS) {
- rw_runlock(&mphyp_eviction_lock);
+ rm_runlock(&mphyp_eviction_lock, &track);
pvo->pvo_pte.slot = index;
return (0);
}
result = phyp_pft_hcall(H_ENTER, 0, pvo->pvo_pte.slot,
pte.pte_hi, pte.pte_lo, &index, &evicted.pte_lo, &junk);
if (result == H_SUCCESS) {
- rw_runlock(&mphyp_eviction_lock);
+ rm_runlock(&mphyp_eviction_lock, &track);
pvo->pvo_pte.slot = index;
return (0);
}
*/
/* Lock out all insertions for a bit */
- if (!rw_try_upgrade(&mphyp_eviction_lock)) {
- rw_runlock(&mphyp_eviction_lock);
- rw_wlock(&mphyp_eviction_lock);
- }
+ rm_runlock(&mphyp_eviction_lock, &track);
+ rm_wlock(&mphyp_eviction_lock);
index = mphyp_pte_spillable_ident(pvo->pvo_pte.slot, &evicted);
if (index == -1L) {
if (index == -1L) {
/* No freeable slots in either PTEG? We're hosed. */
- rw_wunlock(&mphyp_eviction_lock);
+ rm_wunlock(&mphyp_eviction_lock);
panic("mphyp_pte_insert: overflow");
return (-1);
}
*/
result = phyp_pft_hcall(H_ENTER, H_EXACT, index, pte.pte_hi,
pte.pte_lo, &index, &evicted.pte_lo, &junk);
- rw_wunlock(&mphyp_eviction_lock); /* All clear */
+ rm_wunlock(&mphyp_eviction_lock); /* All clear */
pvo->pvo_pte.slot = index;
if (result == H_SUCCESS)