Issue #3475 has been reported by tuxillo. ---------------------------------------- Bug #3475: x86_64: a crash dump can stall in smp_invltlb() and never finish http://bugs.dragonflybsd.org/issues/3475
* Author: tuxillo * Status: New * Priority: Normal * Target version: 6.6 * Start date: 2026-11-21 ---------------------------------------- As of master e2619a112f, a crash dump on x86_64 can stop making progress and never finish. The minidump (blk_write() in minidump_machdep.c) and the full dump (cb_dumpdata() in dump_machdep.c) both call smp_invltlb() after mapping each chunk into crashdumpmap. The other cpus are stopped for the panic, and when one of them doesn't answer the IPI, smp_invltlb() waits invlpg_timeout seconds (10, or 60 in a VM), prints "smp_invltlb: giving up", and the next chunk waits again. In a QEMU guest that was a minute per chunk, so a 570 MB dump would have taken more than a day. The cross-cpu flush isn't needed: pmap_kenter_quick() already does invlpg on the current cpu, and only the dumping cpu reads crashdumpmap. The calls came in with fb8345e665 (2011) to replace pmap_kenter()'s IPI-queue invalidation. FreeBSD's amd64 dump code doesn't flush there at all. The attached patch flushes only the dumping cpu (cpu_invltlb()) in both places, and fixes the pmap_kenter_temporary() comment that told callers to use smp_invltlb(). To test it I panicked with sysctl debug.panic=1 while other processes kept the cpus busy with TLB shootdowns. In a 4-vCPU QEMU guest, 2 of 6 minidumps stalled before the patch and 10 of 10 completed after it. On a 12-thread machine with 32 GB, with the attached tlbchurn.c as the load, 5 of 5 minidumps and 3 of 3 full dumps completed with the patch; I didn't run an unpatched kernel there. In two of those minidumps another cpu spent the whole dump in smp_inval_intr() waiting for a cpu that never answered, which is what the old code would have waited on. >From reading the code, the cpu that never answers probably took the stop IPI >while inside smp_inval_intr() and parked there. That's a separate problem, and >this patch doesn't touch it. ---Files-------------------------------- tlbchurn.c (3.64 KB) 0001-x86_64-don-t-shoot-down-other-cpus-TLBs-while-dumpin.patch (4.22 KB) -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
