[Bug 293382] Dead lock and kernel crash around closefp_impl

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 16 Apr 2026 09:49:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293382

--- Comment #77 from Konstantin Belousov <kib@FreeBSD.org> ---
It might be interesting to try this (debugging) patch, instead of disabling
INVLPGB use.  It is possible that I mis-handle the ranged invalidation.

diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 3b16845e2d87..f503430f37b2 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -732,33 +732,7 @@ smp_masked_invlpg_range(vm_offset_t addr1, vm_offset_t
addr2, pmap_t pmap,
     smp_invl_cb_t curcpu_cb)
 {
        if (invlpgb_works && pmap == kernel_pmap) {
-               vm_offset_t va;
-               uint64_t cnt, total;
-
-               addr1 = trunc_page(addr1);
-               addr2 = round_page(addr2);
-               total = atop(addr2 - addr1);
-               for (va = addr1; total > 0;) {
-                       if ((va & PDRMASK) != 0 || total < NPDEPG) {
-                               cnt = atop(NBPDR - (va & PDRMASK));
-                               if (cnt > total)
-                                       cnt = total;
-                               if (cnt > invlpgb_maxcnt + 1)
-                                       cnt = invlpgb_maxcnt + 1;
-                               invlpgb(INVLPGB_GLOB | INVLPGB_VA | va, 0,
-                                   cnt - 1);
-                               va += ptoa(cnt);
-                               total -= cnt;
-                       } else {
-                               cnt = total / NPTEPG;
-                               if (cnt > invlpgb_maxcnt + 1)
-                                       cnt = invlpgb_maxcnt + 1;
-                               invlpgb(INVLPGB_GLOB | INVLPGB_VA | va, 0,
-                                   INVLPGB_2M_CNT | (cnt - 1));
-                               va += cnt << PDRSHIFT;
-                               total -= cnt * NPTEPG;
-                       }
-               }
+               invlpgb(INVLPGB_GLOB, 0, 0);
                tlbsync();
                sched_unpin();
                return;

-- 
You are receiving this mail because:
You are the assignee for the bug.