[v2,0/4] driver core: Decouple device links enforcing and probe deferral timeouts

Message ID 20221116115348.517599-1-javierm@redhat.com
Headers
Series driver core: Decouple device links enforcing and probe deferral timeouts |

Message

Javier Martinez Canillas Nov. 16, 2022, 11:53 a.m. UTC
  This series is a v2 of patch "driver core: Disable driver deferred probe
timeout by default" [0] but using a slightly different approach after the
feedback I got on v1.

The problem with v1 was that just disabling the probe deferral timeout by
default would cause a regression for drivers that may want to probe even
if their (optional) dependencies are not present yet.

But this was achieved by timing out the probe deferral mechanism, which
calls fw_devlink_drivers_done() in its work queue function handler. There
is not reason to tie the two though, it should be possible to relax the
device links to allow drivers to probe even if their optional suppliers
are not present, while still keep the probe deferral mechanism enabled
so that drivers that have required dependencies are still able to defer
their probe.

This series decouple the two operations by adding a fw_devlink.timeout=
command line parameter. That way, the probe deferral timeout can be set
to -1 by default, reverting to the previous behaviour while still allow
drivers to probe with optional dependencies missing.

Patch #1 is just a cleanup that makes the driver_deferred_probe_timeout
variable static since isn't used outside of its compilation unit.

Patch #2 disables the deferred probe mechanism after late_initcall if
modules are disable. Since there is no point to schedule the timer in
that case.

Patch #3 adds the new "fw_devlink.timeout=" cmdline param, that can be
used to set a timeout for the device links enforcing. The semantics are
quite similar to the existing "deferred_probe_timeout=" cmdline param.

Patch #4 then changes the default value for the probe deferral timeout,
to just disable it by default and make the probe deferral mechanism to
revert to the behaviour that had before. That is, to just try to probe
the drivers indefinitely. But the device link enforcing timeout is set
to 10 seconds, to keep the existing expectations for drivers that want
to probe even if their optional dependencies are not present.

I have tested on my HP X2 Chromebook and the DRM driver that was failing
to probe before now works without any cmdline parameters. I also tested
with different combinations of device links and deferred probe timeouts.

[0]: https://lore.kernel.org/lkml/354820e8-939c-781a-0d76-c1574c43b7f3@redhat.com/T/#t

Best regards,
Javier

Changes in v2:
- Mention in the commit messsage the specific machine and drivers that
  are affected by the issue (Greg).
- Double check the commit message for accuracy (John).
- Add a second workqueue to timeout the devlink enforcing and allow
  drivers to probe even without their optional dependencies available.

Javier Martinez Canillas (4):
  driver core: Make driver_deferred_probe_timeout a static variable
  driver core: Set deferred probe timeout to 0 if modules are disabled
  driver core: Add fw_devlink.timeout param to stop waiting for devlinks
  driver core: Disable driver deferred probe timeout by default

 .../admin-guide/kernel-parameters.txt         |  7 +++
 drivers/base/dd.c                             | 48 +++++++++++++++----
 include/linux/device/driver.h                 |  1 -
 3 files changed, 47 insertions(+), 9 deletions(-)