Device dependencies and deferred probing
The core problem, Mark said, is that there is no way to tell the kernel's
device model about dependencies between devices. Rafael Wysocki responded
that the real issue is dependencies between drivers, but Mark
disagreed, saying that a dependency shows itself as one device waiting for
another specific device to be instantiated. He noted that there is
currently a deferred probing patch set
under discussion, but it doesn't address the full problem. In particular,
it doesn't address suspend/resume operations (when devices must be
suspended and resumed in the proper order), and it does nothing to speed
boot time.
Grant Likely said that the problem is with the tree-oriented device model, which is not able to describe the dependencies in real-world systems. This point was generally agreed — it has been understood for a while — but solutions are still hard to come by. Greg Kroah-Hartman described deferred probing as a "hack workaround" for the problem, but didn't immediately offer a less hacky alternative.
There was some talk about the nature of device dependencies. Some of them are described in the system's firmware (or device tree). Others only show up when drivers initialize themselves and can't be seen at boot time. Dependencies can even change over the lifetime of the system as devices are configured in different ways. Tim Bird suggested using the phandles (inter-device references) found in the system's device tree; there is a lot of dependency information to be found there. Most dependencies are "stupid clocks and regulators"; creating a graph of such dependencies prior to device probing would solve a lot of problems, he said.
Greg, despite his earlier comment on deferred probing, now asked whether a more complex dependency graph was needed. Nobody has demonstrated real problems resulting from excessive deferral of device probing. Tim said that readily available dependency information could at least be used to perform hinting; Rafael agreed that pulling together as much information as possible would help the kernel to get the probing order roughly right.
As a whole, the group seemed to agree that the problem is real, and that it
should somehow be solved in the driver core. An important first step would
be to
come up with a way to register dependencies from the information that is
already available. Rafael promised to post a proposal with some ideas; he
followed through later that day.
| Index entries for this article | |
|---|---|
| Kernel | Device drivers/Asynchronous probing |
| Conference | Kernel Summit/2015 |
Posted Nov 4, 2015 13:14 UTC (Wed)
by tpetazzoni (subscriber, #53127)
[Link] (1 responses)
It is not exactly what Rafael said I believe. What Rafael said is that dependencies are not just between devices, but between devices that are actually *bound* to a driver to manage them. Indeed if a device A needs another device B, it doesn't just need this device B to have its platform_device registered. It also needs device B to be bound to a device driver, of which the ->probe() method has been called to actually do something with device B, so that it can be used by device A. So device A ->probe() should ideally only be triggered when device B ->probe() has completed. Having device B "registered" is not sufficient.
Posted Nov 6, 2015 12:30 UTC (Fri)
by broonie (subscriber, #7078)
[Link]
Rafael Wysocki responded that the real issue is dependencies between drivers
Device dependencies and deferred probing
Device dependencies and deferred probing
