[Bug 298381] iwlwifi: hang during interface teardown, TX task stuck in taskqueue_drain() via lkpi_ic_node_free()
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 298381] iwlwifi: hang during interface teardown, TX task stuck in taskqueue_drain() via lkpi_ic_node_free()"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 298381] iwlwifi: hang during interface teardown, TX task stuck in taskqueue_drain() via lkpi_ic_node_free()"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 298381] iwlwifi: hang during interface teardown, TX task stuck in taskqueue_drain() via lkpi_ic_node_free()"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 10 Sep 2026 23:46:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298381
Bug ID: 298381
Summary: iwlwifi: hang during interface teardown, TX task stuck
in taskqueue_drain() via lkpi_ic_node_free()
Product: Base System
Version: CURRENT
Hardware: amd64
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: wireless
Assignee: wireless@FreeBSD.org
Reporter: david@remdrivet.se
Created attachment 274619
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=274619&action=edit
dmesg of the hang
Hi,
I have been trying to track down an occasional iwlwifi hang on FreeBSD-current.
I am experimenting a bit with using an LLM as a "friendly AI" to help me
understand the kernel code and follow the different paths involved. My own
coding knowledge is fairly limited, especially when it comes to kernel locking,
taskqueues, well anything kernel related really, so please take my analysis
below with some caution.
I hope the information and stacks are useful even if my interpretation turns
out to be wrong.
The hang happened while the interface was being torn down. ifconfig,
wpa_supplicant, devctl, and the net80211 taskqueue all ended up waiting.
One stack that caught my attention was:
kernel thread taskq
mi_switch
_sleep
taskqueue_drain
lkpi_ic_node_free
ieee80211_tx_complete
linuxkpi_ieee80211_free_txskb
lkpi_80211_txq_tx_one
lkpi_80211_txq_task
taskqueue_run_locked
taskqueue_thread_loop
At the same time I had:
iwlwifi0 net80211 t
mi_switch
_sx_xlock_hard
lkpi_ic_scan_start
scan_start
taskqueue_run_locked
taskqueue_thread_loop
and:
ifconfig
mi_switch
_sx_xlock_hard
lkpi_ic_vap_delete
wlan_clone_destroy
if_clone_destroyif_flags
if_clone_destroy
ifioctl
kern_ioctl
sys_ioctl
There were also wpa_supplicant and devctl processes waiting during the
teardown.
The wpa_supplicant stack included:
wpa_supplicant
mi_switch
_sleep
taskqueue_drain
ieee80211_waitfor_parent
ieee80211_ioctl
ifhwioctl
ifioctl
kern_ioctl
sys_ioctl
and the devctl stack was:
devctl
mi_switch
sleepq_timedwait
_sleep
pause_sbt
ieee80211_com_vdetach
ieee80211_ifdetach
linuxkpi_ieee80211_unregister_hw
iwl_op_mode_mvm_stop
iwl_drv_stop
iwl_pcie_gen1_2_remove
linux_pci_detach_device
linux_pci_detach
device_detach
...
What seemed particularly interesting to me was the first stack, where
lkpi_80211_txq_task() appears below taskqueue_drain().
LLM-assisted analysis — this part should probably be double-checked
The following analysis was done with the help of an LLM. I have tried to check
the referenced code against the source, but my understanding of the kernel code
and its locking/lifetime rules is limited. Someone familiar with
LinuxKPI/net80211 should probably double-check this analysis before assuming
the conclusion is correct.
With that caveat, we followed the stack through linux_80211.c.
The TX task is initialized with lsta as its argument:
TASK_INIT(&lsta->txq_task, 0, lkpi_80211_txq_task, lsta);
and eventually calls:
lkpi_80211_txq_tx_one(lsta, m);
That function gets the node from the same lsta:
ni = lsta->ni;
and stores it with the mbuf:
skb->m = m;
m->m_pkthdr.PH_loc.ptr = ni;
The TX completion path appears to retrieve it again and can end up in
lkpi_ic_node_free(), where:
lsta = ni->ni_drv_data;
lkpi_lsta_free(lsta, ni);
The two are linked when allocated:
lsta->ni = ni;
ni->ni_drv_data = lsta;
and lkpi_lsta_free() contains:
while (taskqueue_cancel(taskqueue_thread, &lsta->txq_task, NULL) != 0)
taskqueue_drain(taskqueue_thread, &lsta->txq_task);
The LLM's interpretation of this is that lkpi_80211_txq_task() may be able to
reach lkpi_lsta_free() through its own TX completion path, and then attempt to
drain the same lsta->txq_task that is currently executing.
If I understand this correctly, the task could be waiting for itself to finish.
But this is where I would rather leave the interpretation to someone who
actually understands this code. There may be details that the LLM and I are
missing.
The LLM initially suspected the scan/wiphy locking because another thread was
stuck in lkpi_ic_scan_start(). Not sure if that is relevant
I could not find an existing report showing the same:
lkpi_80211_txq_task
-> lkpi_80211_txq_tx_one
-> linuxkpi_ieee80211_free_txskb
-> ieee80211_tx_complete
-> lkpi_ic_node_free
-> taskqueue_drain
stack, so I thought it was better to report this separately rather than assume
it is one of the above.
Possibly related bugs:
While trying to understand this I found a few reports and changes concerning
iwlwifi/LinuxKPI 802.11 teardown. I don't know if any of these are actually
related to this, but they seemed close enough to mention:
FreeBSD PR 275255:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275255
Commit f68ebebd8ae4, "LinuxKPI: 802.11: change teardown order of disassoc and
sta rm":
https://lists.freebsd.org/archives/dev-commits-src-main/2026-March/040374.html
FreeBSD PR 294449:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294449
I am mostly posting this in the hope that the stack traces and the path I
followed can save someone more familiar with this code some time.
I am also experimenting with whether an LLM can be useful as an aid for
narrowing down bugs like this as someone who are not good with coding but
really like to help.
If there are other traces, debug options, lock information, or specific state I
should collect the next time this happens, I am happy to try.
Thanks!
--
You are receiving this mail because:
You are the assignee for the bug.