The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=dec79d2b47b3cb797d45b8bee7a1640dec85ebcc
commit dec79d2b47b3cb797d45b8bee7a1640dec85ebcc Author: Justin Hibbits <[email protected]> AuthorDate: 2026-07-05 23:03:31 +0000 Commit: Justin Hibbits <[email protected]> CommitDate: 2026-07-06 21:23:55 +0000 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. --- sys/powerpc/booke/pmap.c | 13 ++++++++----- 1 file 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. */
