diff options
| author | Justin Hibbits <jhibbits@FreeBSD.org> | 2026-07-05 23:03:31 +0000 |
|---|---|---|
| committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2026-07-06 21:23:55 +0000 |
| commit | dec79d2b47b3cb797d45b8bee7a1640dec85ebcc (patch) | |
| tree | aad6a74991fe5e2eec2d5578a89a20113b1198bc | |
| parent | 5f4c87e6503cd0e1644b86201eafdb11e7e53b90 (diff) | |
powerpc/pmap(booke): Fix TLB TID eviction
Fix tid_set_busy() for when `pmap` is NULL. Obviously a NULL pointer
cannot be correctly used, so I'm not sure how it worked in testing on
64-bit.
| -rw-r--r-- | sys/powerpc/booke/pmap.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index 310d38d5c450..545416921d09 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -2484,11 +2484,14 @@ mmu_booke_page_array_startup(long pages) static __inline void tid_set_busy(int cpu, int tid, pmap_t pmap) { - tidbusy[cpu * (tid_max + 1) + tid] = pmap; - if (pmap == NULL) - pmap->pm_tid[cpu] = TID_NONE; - else + volatile pmap_t *pm = &tidbusy[cpu * (tid_max + 1) + tid]; + + if (pmap == NULL) { + if (*pm != NULL) + (*pm)->pm_tid[cpu] = TID_NONE; + } else pmap->pm_tid[cpu] = tid; + *pm = pmap; } static __inline pmap_t @@ -2522,7 +2525,7 @@ tid_alloc(pmap_t pmap) /* If we are stealing TID then clear the relevant pmap's field */ if (tid_get_busy(thiscpu, tid) != NULL) { CTR2(KTR_PMAP, "%s: warning: stealing tid %d", __func__, tid); - + tid_set_busy(thiscpu, tid, NULL); /* Flush all entries from TLB0 matching this TID. */ |
