Date: Wed, 01 Apr 2026 11:16:36 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: c6a1c1260f02 - main - pmap: Do not use PMAP_LOCK_INIT with kernel_pmap Message-ID: <69ccfe94.43cd0.742774e2@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c6a1c1260f02e44b7f44b1e3735ce5dbd785544d commit c6a1c1260f02e44b7f44b1e3735ce5dbd785544d Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-04-01 09:15:26 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-04-01 11:15:42 +0000 pmap: Do not use PMAP_LOCK_INIT with kernel_pmap The kernel_pmap lock is a bit special: it does not need the DUPOK flag, and it really belongs to a different lock class. If it belongs to the same class as regular pmap locks, then witness may report warnings when performing UMA allocations under a regular pmap lock, if the allocation triggers a pmap_growkernel() call. Replace instances of PMAP_LOCK_INIT(kernel_pmap) with inline mtx_init() calls to silence some witness warnings for harmless behaviour I see with some uncommitted test programs. Reviewed by: alc, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D56185 --- sys/amd64/amd64/pmap.c | 2 +- sys/arm/arm/pmap-v6.c | 2 +- sys/arm64/arm64/pmap.c | 2 +- sys/i386/i386/pmap.c | 2 +- sys/powerpc/aim/mmu_oea.c | 2 +- sys/powerpc/aim/mmu_oea64.c | 2 +- sys/powerpc/aim/mmu_radix.c | 2 +- sys/powerpc/booke/pmap.c | 2 +- sys/riscv/riscv/pmap.c | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 8695dd61316e..956e9c5e78d2 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2127,7 +2127,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) * DMAP_TO_PHYS()/PHYS_TO_DMAP() are functional only after * kva_layout is fixed. */ - PMAP_LOCK_INIT(kernel_pmap); + mtx_init(&kernel_pmap->pm_mtx, "kernel pmap", NULL, MTX_DEF); if (la57) { kva_layout = kva_layout_la57; vtoptem = ((1ul << (NPTEPGSHIFT + NPDEPGSHIFT + NPDPEPGSHIFT + diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index d67267bba4e2..00f9766e9a54 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -1173,7 +1173,7 @@ pmap_bootstrap(vm_offset_t firstaddr) /* * Initialize the kernel pmap (which is statically allocated). */ - PMAP_LOCK_INIT(kernel_pmap); + mtx_init(&kernel_pmap->pm_mtx, "kernel pmap", NULL, MTX_DEF); kernel_l1pa = (vm_paddr_t)kern_pt1; /* for libkvm */ kernel_pmap->pm_pt1 = kern_pt1; kernel_pmap->pm_pt2tab = kern_pt2tab; diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 86ef7359bbe9..678030f827dd 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1347,7 +1347,7 @@ pmap_bootstrap(void) /* Set this early so we can use the pagetable walking functions */ kernel_pmap_store.pm_l0 = pagetable_l0_ttbr1; - PMAP_LOCK_INIT(kernel_pmap); + mtx_init(&kernel_pmap->pm_mtx, "kernel pmap", NULL, MTX_DEF); kernel_pmap->pm_l0_paddr = pmap_early_vtophys((vm_offset_t)kernel_pmap_store.pm_l0); TAILQ_INIT(&kernel_pmap->pm_pvchunk); diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 2f9e6ccf43a8..fd5ac272a441 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -630,7 +630,7 @@ __CONCAT(PMTYPE, bootstrap)(vm_paddr_t firstaddr) * Count bootstrap data as being resident in case any of this data is * later unmapped (using pmap_remove()) and freed. */ - PMAP_LOCK_INIT(kernel_pmap); + mtx_init(&kernel_pmap->pm_mtx, "kernel pmap", NULL, MTX_DEF); kernel_pmap->pm_pdir = IdlePTD; #ifdef PMAP_PAE_COMP kernel_pmap->pm_pdpt = IdlePDPT; diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index b1f74597aa42..adf5fd10e3de 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -878,7 +878,7 @@ moea_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) /* * Initialize the kernel pmap (which is statically allocated). */ - PMAP_LOCK_INIT(kernel_pmap); + mtx_init(&kernel_pmap->pm_mtx, "kernel pmap", NULL, MTX_DEF); for (i = 0; i < 16; i++) kernel_pmap->pm_sr[i] = EMPTY_SEGMENT + i; CPU_FILL(&kernel_pmap->pm_active); diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 22442c59fd30..247bd30e6bd4 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1089,7 +1089,7 @@ moea64_mid_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) CPU_FILL(&kernel_pmap->pm_active); RB_INIT(&kernel_pmap->pmap_pvo); - PMAP_LOCK_INIT(kernel_pmap); + mtx_init(&kernel_pmap->pm_mtx, "kernel pmap", NULL, MTX_DEF); /* * Now map in all the other buffers we allocated earlier diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 85008de83870..1fc8a23269e5 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -1842,7 +1842,7 @@ mmu_radix_setup_pagetables(vm_size_t hwphyssz) vm_paddr_t l1phys; bzero(kernel_pmap, sizeof(struct pmap)); - PMAP_LOCK_INIT(kernel_pmap); + mtx_init(&kernel_pmap->pm_mtx, "kernel pmap", NULL, MTX_DEF); vm_radix_init(&kernel_pmap->pm_radix); ptpages = allocpages(3); diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index f76f17bd8450..08516b151e6b 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -901,7 +901,7 @@ mmu_booke_bootstrap(vm_offset_t start, vm_offset_t kernelend) /*******************************************************/ /* Initialize (statically allocated) kernel pmap. */ /*******************************************************/ - PMAP_LOCK_INIT(kernel_pmap); + mtx_init(&kernel_pmap->pm_mtx, "kernel pmap", NULL, MTX_DEF); debugf("kernel_pmap = 0x%"PRI0ptrX"\n", (uintptr_t)kernel_pmap); kernel_pte_alloc(virtual_avail, kernstart); diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 3fc261a15c06..e9f88f5d653e 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -921,7 +921,7 @@ pmap_bootstrap(vm_paddr_t kernstart, vm_size_t kernlen) printf("pmap_bootstrap %lx %lx\n", kernstart, kernlen); - PMAP_LOCK_INIT(kernel_pmap); + mtx_init(&kernel_pmap->pm_mtx, "kernel pmap", NULL, MTX_DEF); TAILQ_INIT(&kernel_pmap->pm_pvchunk); vm_radix_init(&kernel_pmap->pm_root);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69ccfe94.43cd0.742774e2>
