git: 90fc3831af15 - stable/15 - pmap: Do not use PMAP_LOCK_INIT with kernel_pmap
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Apr 2026 15:56:50 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=90fc3831af1568a465d6be3dc0f40c1a87285c7c
commit 90fc3831af1568a465d6be3dc0f40c1a87285c7c
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-04-01 09:15:26 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-04-16 15:56:26 +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
(cherry picked from commit c6a1c1260f02e44b7f44b1e3735ce5dbd785544d)
---
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 44ec9f1672fe..cae46f7c2f1e 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 ae17b3289593..2783f460402b 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 01bf4c7e90a8..3eb9de8a16c2 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -1124,7 +1124,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 a12142fc2d7b..387c172b446c 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -1843,7 +1843,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);