Page MenuHomeFreeBSD

PCI hot-plug: use dedicated taskqueue for device attach / detach
ClosedPublic

Authored by avg on May 6 2021, 5:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 18, 4:41 PM
Unknown Object (File)
Tue, Apr 28, 12:48 PM
Unknown Object (File)
Tue, Apr 28, 8:54 AM
Unknown Object (File)
Sat, Apr 25, 6:01 AM
Unknown Object (File)
Fri, Apr 24, 12:42 AM
Unknown Object (File)
Apr 20 2026, 3:47 PM
Unknown Object (File)
Apr 20 2026, 3:40 AM
Unknown Object (File)
Apr 19 2026, 9:11 PM
Subscribers

Details

Summary

Attaching and detaching devices can be heavy-weight and detaching can
sleep waiting for events. For that reason using the system-wide
single-threaded taskqueue_thread is not really appropriate.
There is even a possibility for a deadlock if taskqueue_thread is used
for detaching.

In fact, there is an easy to reproduce deadlock involving nvme, pass
and a sudden removal of an NVMe device.
A pass peripheral would not release a reference on an nvme sim until
pass_shutdown_kqueue() is executed via taskqueue_thread. But the
taskqueue's thread is blocked in nvme_detach() -> ... -> cam_sim_free()
because of the outstanding reference.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 39051
Build 35940: arc lint + arc unit