Date: Thu, 11 Jun 2026 09:41:10 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 295992] bnxt: System hangs when nstat and sysctl -a run concurrently Message-ID: <bug-295992-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295992 Bug ID: 295992 Summary: bnxt: System hangs when nstat and sysctl -a run concurrently Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: sumit.saxena@broadcom.com While running the heavy traffic on Broadcom 400G NIC(Thor2), I observed a temporary system hang which causes traffic to come to halt for some time when nstat (Network traffic monitoring tool) is running and "sysctl -a" is run in parallel. The issue is intermittent. Below are the traces of both threads with our analysis: ------------- nstat: # procstat -kk 39693 PID TID COMM TDNAME KSTACK 39693 101860 nstat - mi_switch+0x172 __mtx_lock_sleep+0x1c1 __mtx_lock_flags+0xdd sysctl_root_handler_locked+0x8c sysctl_root+0x22f userland_sysctl+0x1b6 kern___sysctlbyname+0x226 sys___sysctlbyname+0x2d amd64_syscall+0x169 fast_syscall_common+0xf8 sysctl -a: # procstat -kk 40586 PID TID COMM TDNAME KSTACK 40586 102075 sysctl - mi_switch+0x172 sched_ule_bind+0x8a cpu_est_clockrate+0x81 hwpstate_get_cppc+0x48 cf_get_method+0xf0 cpufreq_curr_sysctl+0x68 sysctl_root_handler_locked+0x9c sysctl_root+0x22f userland_sysctl+0x1b6 sys___sysctl+0x65 amd64_syscall+0x169 fast_syscall_common+0xf8 It's a timing-related temporarily system hang when the traffic monitoring tool nstat and sysctl -a are queried concurrently. This conflict results in both threads hanging temporarily, causing a CPU halt that leads nstat to report zero Tx/Rx packets and NaN CPU utilization once the hang resolves. The root cause is a Giant mutex convoy triggered by the cpufreq sysctl handler. Specifically, the sysctl -a process acquires the Giant mutex and then attempts to migrate to a specific CPU to read clock rates, where it remains blocked if that target CPU is saturated with NIC traffic. Trace Analysis: - sysctl -a (The Blocker): Holds the Giant mutex while executing cpufreq_curr_sysctl. The handler calls hwpstate_get_cppc, which invokes cpu_est_clockrate. Inside cpu_est_clockrate, the thread calls sched_bind to migrate to the target CPU. Because the target CPU is busy, mi_switch is called, and the thread sleeps while still holding the Giant mutex. - nstat (The Victim): Attempts to execute a sysctl call but becomes blocked at __mtx_lock_sleep while waiting for the Giant mutex held by the sysctl thread. Technical Details: - Giant Acquisition: kern_sysctl.c (Lines 22-23) acquires the mutex because the OID lacks the CTLFLAG_MPSAFE flag. - CPU Migration: cpu_machdep.c (Lines 444-450) forces the thread to bind to the target cpu_id via sched_bind. - Thread State: The sysctl thread remains in mi_switch within sched_ule.c (Line 3023) until the target CPU can schedule it, effectively locking out any other processes (like nstat) that require the Giant mutex. ------------------ -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-295992-227>
