newbus: Create a knob to disable devices that fail to attach.
authorWarner Losh <imp@FreeBSD.org>
Sun, 4 Dec 2022 23:20:24 +0000 (16:20 -0700)
committerWarner Losh <imp@FreeBSD.org>
Sun, 4 Dec 2022 23:20:24 +0000 (16:20 -0700)
commitaa52c6bdd7b157b7c5d9612e4feac5c94f376df6
treede41c8c40bed17bf5fe2e260cbc79098d530c32b
parent9f7269677c5e70283a16887e1e4b4a1ed95a96fb
newbus: Create a knob to disable devices that fail to attach.

Normally, when a device fails to attach, we tear down the newbus state
for that device so that future driver loads can try again (maybe with a
different driver, or maybe with a re-loaded and fixed kld).

Sometimes, however, it is desirable to have the device fail
permanantly. We do this by calling device_disable() on a failed
attached, as well as keeping the device in DS_ATTACHING forever. This
prevents retries on that device. This is enabled via
hw.bus.disable_failed_devices=1 in either a hint via the loader, or at
runtime with a sysctl setting. Setting from 1 -> 0 at runtime will not
affect previously disabled devices, however: they remain disabled.
They can be re-enabled manually with devctl enable, however.

Sponsored by: Netflix

Reviewed by: gallatin, hselasky, jhb
Differential Revision: https://reviews.freebsd.org/D37517
sys/kern/subr_bus.c