nvme_ctrlr_start_config_hook() runs in the boot thread, one controller after
another, and sleeps in nvme_ctrlr_hw_reset() until the controller reports
ready: about 2.3 s for each Samsung PM1725a, in series. A machine with
several enterprise NVMe drives spends that time added up.
Let the first hook start the reset of every controller that is still waiting
for its config hook, each in that controller's own taskqueue thread, and have
each hook wait for its own controller's reset. The rest of a hook -- identify,
the I/O queues, attaching the CAM bus -- runs as before, in the hooks' order,
so the scbus and nda unit numbers do not depend on which drive becomes ready
first. A controller that is somehow not in the nvme devclass (it cannot
happen in practice) resets itself in its hook, exactly as before.
The reset wait becomes the slowest drive's instead of the sum.
With one or two drives this saves little. It is meant for servers with many
NVMe drives, where the per-drive reset times add up, and for systems that have
a boot-time budget, where shortening the device-probe phase is worth it.
Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
Sponsored by: keelos.dev