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
F102106949: D30144.id88747.diff
Thu, Nov 7, 4:56 PM
Unknown Object (File)
Fri, Oct 18, 5:35 PM
Unknown Object (File)
Sep 27 2024, 7:22 AM
Unknown Object (File)
Sep 24 2024, 7:22 PM
Unknown Object (File)
Sep 18 2024, 7:58 PM
Unknown Object (File)
Sep 7 2024, 10:54 PM
Unknown Object (File)
Sep 4 2024, 10:48 PM
Unknown Object (File)
Sep 3 2024, 5:50 AM
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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable