Make deferring probe forever optional
Subsystems (15)
Rob Herring
maintainerv4 cover Make deferring probe forever optional
This series came out of a discussion on the ARM boot-architecture list[1] about DT forwards and backwards compatibility issues. There are issues with newer DTs breaking on older, stable kernels. Some of these are difficult to solve, but cases of optional devices not having kernel support should be solvable.
I tested this on a RPi3 B with the pinctrl driver forced off. With this change, the MMC/SD and UART drivers can function without the pinctrl driver. I left the dts change out this time.
v2 and v3 of this series can be found here[2][3].
Rob
[1] https://lists.linaro.org/pipermail/boot-architecture/2018-April/000466.html
[2] https://lore.kernel.org/patchwork/project/lkml/list/?series=347413
[3] https://lore.kernel.org/patchwork/project/lkml/list/?series=357344
Rob Herring (6):
driver core: allow stopping deferred probe after init
dt-bindings: pinctrl: add a 'pinctrl-use-default' property
pinctrl: Support stopping deferred probe after initcalls
iommu: Stop deferring probe at end of initcalls
iommu: Remove IOMMU_OF_DECLARE
PM / Domains: Stop deferring probe at the end of initcall
.../admin-guide/kernel-parameters.txt | 9 +++ .../bindings/pinctrl/pinctrl-bindings.txt | 6 ++ drivers/base/dd.c | 59 +++++++++++++++++++ drivers/base/power/domain.c | 2 +- drivers/iommu/arm-smmu-v3.c | 2 - drivers/iommu/arm-smmu.c | 7 --- drivers/iommu/exynos-iommu.c | 2 - drivers/iommu/ipmmu-vmsa.c | 3 - drivers/iommu/msm_iommu.c | 2 - drivers/iommu/of_iommu.c | 21 +------ drivers/iommu/qcom_iommu.c | 2 - drivers/iommu/rockchip-iommu.c | 2 - drivers/pinctrl/devicetree.c | 15 +++-- include/asm-generic/vmlinux.lds.h | 2 - include/linux/device.h | 2 + include/linux/of_iommu.h | 4 -- 16 files changed, 90 insertions(+), 50 deletions(-)
--
2.17.1
Rob Herring
maintainerPATCH v4 1/6 driver core: allow stopping deferred probe after init
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version. Deferred probe issues can be difficult to debug especially if the console has dependencies or userspace fails to boot to a shell.
There are also cases like IOMMUs where only built-in drivers are supported, so deferring probe after initcalls is not needed. The IOMMU subsystem implemented its own mechanism to handle this using OF_DECLARE linker sections.
This commit adds makes ending deferred probe conditional on initcalls being completed or a debug timeout. Subsystems or drivers may opt-in by calling driver_deferred_probe_check_init_done() instead of unconditionally returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.
The timeout mechanism is intended for debug purposes and WARNs loudly. The remaining deferred probe pending list will also be dumped after the timeout. Not that this timeout won't work for the console which needs to be enabled before userspace starts. However, if the console's dependencies are resolved, then the kernel log will be printed (as opposed to no output).
---
v4:
- Rebase on driver-core-next
- Only allow base 10 for timeout
v3:
- Merged with timeout patch.
- Clarify that deferred_probe_timeout is a debug option.
- Drop the 'optional' param. The only user was pinctrl, so it has to handle that functionality.
- Rename function to driver_deferred_probe_check_state
- Added kerneldoc for driver_deferred_probe_check_state
- Print a 1 line warning if stopping deferred probe after initcalls and a WARN on timeout.
.../admin-guide/kernel-parameters.txt | 9 +++ drivers/base/dd.c | 59 +++++++++++++++++++ include/linux/device.h | 2 + 3 files changed, 70 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +9 -0
@@ -804,6 +804,15 @@ Defaults to the default architecture's huge page size if not specified. + deferred_probe_timeout= + [KNL] Debugging option to set a timeout in seconds for + deferred probe to give up waiting on dependencies to + probe. Only specific dependencies (subsystems or + drivers) that have opted in will be ignored. A timeout of 0 + will timeout at the end of initcalls. This option will also + dump out devices still on the deferred probe list after + retrying. + dhash_entries= [KNL] Set number of hash buckets for dentry cache.
drivers/base/dd.c +59 -0
77 lines not on this page · raw message
include/linux/device.h +2 -0
@@ -339,6 +339,8 @@ struct device *driver_find_device(struct device_driver *drv, struct device *start, void *data, int (*match)(struct device *dev, void *data)); +int driver_deferred_probe_check_state (struct device *dev); +/** * struct subsys_interface - interfaces to device functions * @name: name of the device function
--
2.17.1
Re: [PATCH v4 1/6] driver core: allow stopping deferred probe after init
Quoted 26 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version. Deferred probe issues can be difficult to debug especially if the console has dependencies or userspace fails to boot to a shell.
There are also cases like IOMMUs where only built-in drivers are supported, so deferring probe after initcalls is not needed. The IOMMU subsystem implemented its own mechanism to handle this using
OF_DECLARElinker sections.This commit adds makes ending deferred probe conditional on initcalls being completed or a debug timeout. Subsystems or drivers may opt-in by calling
driver_deferred_probe_check_init_done()instead of unconditionally returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.
Quoted 6 lines
The timeout mechanism is intended for debug purposes and WARNs loudly. The remaining deferred probe pending list will also be dumped after the timeout. Not that this timeout won't work for the console which needs to be enabled before userspace starts. However, if the console's dependencies are resolved, then the kernel log will be printed (as opposed to no output).
So what happens if we have a set of modules which use deferred probing in order to work?
For example, with sound stuff built as modules, and auto-loaded in parallel by udev, the modules get added in a random order. The modules have non-udev obvious dependencies between them (resource dependencies) which result in deferred probing being necessary to bring the device up.
Eg,
snd_soc_kirkwood_spdif module declares the ASoC card. snd_soc_spdif_tx is a codec as a loadable module. snd_soc_kirkwood is the CPU digital audio interface module.
What I commonly see is this module load order:
snd_soc_kirkwood_spdif, then snd_soc_kirkwood and then snd_soc_spdif_tx.
This results at boot in:
kirkwood-spdif-audio audio-subsystem: ASoC: CPU DAI kirkwood-fe not registered kirkwood-spdif-audio audio-subsystem: ASoC: CPU DAI kirkwood-fe not registered kirkwood-spdif-audio audio-subsystem: ASoC: CPU DAI kirkwood-fe not registered kirkwood-spdif-audio audio-subsystem: ASoC: CPU DAI kirkwood-fe not registered kirkwood-spdif-audio audio-subsystem: ASoC: CPU DAI kirkwood-fe not registered kirkwood-spdif-audio audio-subsystem: ASoC: CODEC DAI dit-hifi not registered kirkwood-spdif-audio audio-subsystem: ASoC: CODEC DAI dit-hifi not registered kirkwood-spdif-audio audio-subsystem: snd-soc-dummy-dai <-> kirkwood-fe mapping ok kirkwood-spdif-audio audio-subsystem: multicodec <-> kirkwood-spdif mapping ok
at boot, where most of these are deferred probe attempts.
So, disabling deferred probing after all the kernel-internal initcalls are run is wrong. You can have deferred probing required due to external modules, and this can kick in at any time (think about hot-pluggable hardware with a driver that's somehow componentised, like an audio device...)
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up According to speedtest.net: 13Mbps down 490kbps up
Rob Herring
maintainerRe: [PATCH v4 1/6] driver core: allow stopping deferred probe after init
Quoted 35 lines · Russell King - ARM Linux
Quoted 26 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version. Deferred probe issues can be difficult to debug especially if the console has dependencies or userspace fails to boot to a shell.
There are also cases like IOMMUs where only built-in drivers are supported, so deferring probe after initcalls is not needed. The IOMMU subsystem implemented its own mechanism to handle this using
OF_DECLARElinker sections.This commit adds makes ending deferred probe conditional on initcalls being completed or a debug timeout. Subsystems or drivers may opt-in by calling
driver_deferred_probe_check_init_done()instead of unconditionally returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Quoted 6 lines
The timeout mechanism is intended for debug purposes and WARNs loudly. The remaining deferred probe pending list will also be dumped after the timeout. Not that this timeout won't work for the console which needs to be enabled before userspace starts. However, if the console's dependencies are resolved, then the kernel log will be printed (as opposed to no output).
Quoted 2 lines
So what happens if we have a set of modules which use deferred probing in order to work?
It is opt-in by subsystem or drivers and mainly intended for subsystems which can be optional or only support built-in drivers. However, I don't really envision many other users other than the ones I converted (pinctrl, iommu, pm-domains). If you look at patch 3, you'll see it is dependent on !CONFIG_MODULES.
For the timeout, well, that's for debugging only. If you get to the point of loading sound modules, you probably don't need the timeout. It's for debugging not booting.
Quoted 5 lines
For example, with sound stuff built as modules, and auto-loaded in parallel by udev, the modules get added in a random order. The modules have non-udev obvious dependencies between them (resource dependencies) which result in deferred probing being necessary to bring the device up.
Rob Herring
maintainerPATCH v4 2/6 dt-bindings: pinctrl: add a 'pinctrl-use-default' property
In reply to Rob HerringPin setup may be optional in some cases such as the reset default works or the pin setup is done by the bootloader. In these cases, it is optional for the OS to support managing the pin controller and pin setup. In order to support this scenario, add a property 'pinctrl-use-default' to indicate that the pin configuration is optional.
--- .../devicetree/bindings/pinctrl/pinctrl-bindings.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt +6 -0
@@ -103,6 +103,12 @@ Optional properties: #pinctrl-cells: Number of pin control cells in addition to the index within the pin controller device instance +pinctrl-use-default: Boolean. Indicates that the OS can use the boot default + pin configuration. This allows using an OS that does not have a + driver for the pin controller. This property can be set either + globally for the pin controller or in child nodes for individual + pin group control. + Pin controller devices should contain the pin configuration nodes that client devices reference.
Signature · 1 line
2.17.1
Rob Herring
maintainerPATCH v4 3/6 pinctrl: Support stopping deferred probe after initcalls
In reply to Rob HerringPinctrl drivers are a common dependency which can prevent a system booting even if the default or bootloader configured settings can work. If a pinctrl node in DT indicates that the default pin setup can be used with the 'pinctrl-use-default' property, then only defer probe until initcalls are done. If the deferred probe timeout is enabled or loadable modules are disabled, then we'll stop deferring probe regardless of the DT property. This gives platforms the option to work without their pinctrl driver being enabled.
Dropped the pinctrl specific deferring probe message as the driver core can print deferred probe related messages if needed.
---
v4:
- Add Linus' R-by.
v3:
- Drop pinctrl deferred probe msg in favor of driver core messages
- Move the handling of "pinctrl-use-default" option out of driver core
- Stop deferring probe if modules are not enabled.
drivers/pinctrl/devicetree.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/pinctrl/devicetree.c +11 -4
@@ -111,17 +111,24 @@ static int dt_to_map_one_config(struct pinctrl *p,int ret;struct pinctrl_map *map;unsigned num_maps; +bool allow_default = false;/* Find the pin controller containing np_config */ np_pctldev =of_node_get (np_config);for (;;) { +if (!allow_default) + allow_default =of_property_read_bool (np_pctldev, +"pinctrl-use-default" ); + np_pctldev =of_get_next_parent (np_pctldev);if (!np_pctldev ||of_node_is_root (np_pctldev)) { -dev_info (p->dev,"could not find pctldev for node %pOF, deferring probe\n" , - np_config);of_node_put (np_pctldev); -/* OK let's just assume this will appear later then */ -return -EPROBE_DEFER ; + ret =driver_deferred_probe_check_state (p->dev); +/* keep deferring if modules are enabled unless we've timed out */ +if (IS_ENABLED (CONFIG_MODULES ) && !allow_default && ret == -ENODEV ) + ret = -EPROBE_DEFER ; + +return ret; }/* If we're creating a hog we can use the passed pctldev */ if (hog_pctldev && (np_pctldev == p->dev->of_node)) {
--
2.17.1
Rob Herring
maintainerPATCH v4 4/6 iommu: Stop deferring probe at end of initcalls
In reply to Rob HerringThe IOMMU subsystem has its own mechanism to not defer probe if driver support is missing. Now that the driver core supports stopping deferring probe if drivers aren't built-in (and probed), use the driver core support so the IOMMU specific support can be removed.
--- drivers/iommu/of_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/of_iommu.c +1 -1
@@ -133,7 +133,7 @@ static int of_iommu_xlate(struct device *dev,* a proper probe-ordering dependency mechanism in future. */ if (!ops) -return -EPROBE_DEFER ; +return driver_deferred_probe_check_state (dev);return ops->of_xlate (dev, iommu_spec); }
Signature · 1 line
2.17.1
Rob Herring
maintainerPATCH v4 5/6 iommu: Remove IOMMU_OF_DECLARE
In reply to Rob HerringNow that we use the driver core to stop deferred probe for missing drivers, IOMMU_OF_DECLARE can be removed.
This is slightly less optimal than having a list of built-in drivers in that we'll now defer probe twice before giving up. This shouldn't have a significant impact on boot times as past discussions about deferred probe have given no evidence of deferred probe having a substantial impact.
--- drivers/iommu/arm-smmu-v3.c | 2 -- drivers/iommu/arm-smmu.c | 7 ------- drivers/iommu/exynos-iommu.c | 2 -- drivers/iommu/ipmmu-vmsa.c | 3 --- drivers/iommu/msm_iommu.c | 2 -- drivers/iommu/of_iommu.c | 19 +------------------ drivers/iommu/qcom_iommu.c | 2 -- drivers/iommu/rockchip-iommu.c | 2 -- include/asm-generic/vmlinux.lds.h | 2 -- include/linux/of_iommu.h | 4 ---- 10 files changed, 1 insertion(+), 44 deletions(-)
drivers/iommu/arm-smmu-v3.c +0 -2
@@ -2915,8 +2915,6 @@ static struct platform_driver arm_smmu_driver = { };module_platform_driver (arm_smmu_driver); -IOMMU_OF_DECLARE (arm_smmuv3,"arm,smmu-v3" ); -MODULE_DESCRIPTION ("IOMMU API for ARM architected SMMUv3 implementations" );MODULE_AUTHOR ("Will Deacon <[email protected]>" );MODULE_LICENSE ("GPL v2" );
drivers/iommu/arm-smmu.c +0 -7
@@ -2211,13 +2211,6 @@ static struct platform_driver arm_smmu_driver = { };module_platform_driver (arm_smmu_driver); -IOMMU_OF_DECLARE (arm_smmuv1,"arm,smmu-v1" ); -IOMMU_OF_DECLARE (arm_smmuv2,"arm,smmu-v2" ); -IOMMU_OF_DECLARE (arm_mmu400,"arm,mmu-400" ); -IOMMU_OF_DECLARE (arm_mmu401,"arm,mmu-401" ); -IOMMU_OF_DECLARE (arm_mmu500,"arm,mmu-500" ); -IOMMU_OF_DECLARE (cavium_smmuv2,"cavium,smmu-v2" ); -MODULE_DESCRIPTION ("IOMMU API for ARM architected SMMU implementations" );MODULE_AUTHOR ("Will Deacon <[email protected]>" );MODULE_LICENSE ("GPL v2" );
drivers/iommu/exynos-iommu.c +0 -2
@@ -1390,5 +1390,3 @@ static int __init exynos_iommu_init(void)return ret; }core_initcall (exynos_iommu_init); - -IOMMU_OF_DECLARE (exynos_iommu_of,"samsung,exynos-sysmmu" );
drivers/iommu/ipmmu-vmsa.c +0 -3
@@ -1108,9 +1108,6 @@ static void __exit ipmmu_exit(void)subsys_initcall (ipmmu_init);module_exit (ipmmu_exit); -IOMMU_OF_DECLARE (ipmmu_vmsa_iommu_of,"renesas,ipmmu-vmsa" ); -IOMMU_OF_DECLARE (ipmmu_r8a7795_iommu_of,"renesas,ipmmu-r8a7795" ); -MODULE_DESCRIPTION ("IOMMU API for Renesas VMSA-compatible IPMMU" );MODULE_AUTHOR ("Laurent Pinchart <[email protected]>" );MODULE_LICENSE ("GPL v2" );
drivers/iommu/msm_iommu.c +0 -2
@@ -877,7 +877,5 @@ static void __exit msm_iommu_driver_exit(void)subsys_initcall (msm_iommu_driver_init);module_exit (msm_iommu_driver_exit); -IOMMU_OF_DECLARE (msm_iommu_of,"qcom,apq8064-iommu" ); -MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Stepan Moskovchenko <[email protected]>" );
drivers/iommu/of_iommu.c +1 -18
@@ -27,9 +27,6 @@#define NO_IOMMU 1 -static const struct of_device_id __iommu_of_table_sentinel -__used __section (__iommu_of_table_end); -/** * of_get_dma_window - Parse *dma-window property and returns 0 if found. *
@@ -98,19 +95,6 @@ int of_get_dma_window(struct device_node *dn, const char *prefix, int index, }EXPORT_SYMBOL_GPL (of_get_dma_window); -static bool of_iommu_driver_present (struct device_node *np) -{ -/* -* If the IOMMU still isn't ready by the time we reach init, assume -* it never will be. We don't want to defer indefinitely, nor attempt -* to dereference __iommu_of_table after it's been freed. -*/ -if (system_state >=SYSTEM_RUNNING ) -return false; - -return of_match_node (&__iommu_of_table, np); -} -static int of_iommu_xlate (struct device *dev,struct of_phandle_args *iommu_spec) {
@@ -120,8 +104,7 @@ static int of_iommu_xlate(struct device *dev, ops =iommu_ops_from_fwnode (fwnode);if ((ops && !ops->of_xlate) || - !of_device_is_available (iommu_spec->np) || - (!ops && !of_iommu_driver_present (iommu_spec->np))) + !of_device_is_available (iommu_spec->np))return NO_IOMMU ; err =iommu_fwspec_init (dev, &iommu_spec->np->fwnode, ops);
drivers/iommu/qcom_iommu.c +0 -2
@@ -945,7 +945,5 @@ static void __exit qcom_iommu_exit(void)module_init (qcom_iommu_init);module_exit (qcom_iommu_exit); -IOMMU_OF_DECLARE (qcom_iommu_dev,"qcom,msm-iommu-v1" ); -MODULE_DESCRIPTION ("IOMMU API for QCOM IOMMU v1 implementations" );MODULE_LICENSE ("GPL v2" );
drivers/iommu/rockchip-iommu.c +0 -2
@@ -1284,8 +1284,6 @@ static int __init rk_iommu_init(void) }subsys_initcall (rk_iommu_init); -IOMMU_OF_DECLARE (rk_iommu_of,"rockchip,iommu" ); -MODULE_DESCRIPTION ("IOMMU API for Rockchip" );MODULE_AUTHOR ("Simon Xue <[email protected]> and Daniel Kurtz <[email protected]>" );MODULE_ALIAS ("platform:rockchip-iommu" );
include/asm-generic/vmlinux.lds.h +0 -2
@@ -218,7 +218,6 @@#define TIMER_OF_TABLES () OF_TABLE(CONFIG_TIMER_OF, timer)#define IRQCHIP_OF_MATCH_TABLE () OF_TABLE(CONFIG_IRQCHIP, irqchip)#define CLK_OF_TABLES () OF_TABLE(CONFIG_COMMON_CLK, clk) -#define IOMMU_OF_TABLES () OF_TABLE(CONFIG_OF_IOMMU, iommu)#define RESERVEDMEM_OF_TABLES () OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)#define CPU_METHOD_OF_TABLES () OF_TABLE(CONFIG_SMP, cpu_method)#define CPUIDLE_METHOD_OF_TABLES () OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method)
@@ -601,7 +600,6 @@ CLK_OF_TABLES() \ RESERVEDMEM_OF_TABLES() \ TIMER_OF_TABLES() \ - IOMMU_OF_TABLES() \ CPU_METHOD_OF_TABLES() \ CPUIDLE_METHOD_OF_TABLES() \KERNEL_DTB () \
include/linux/of_iommu.h +0 -4
@@ -32,8 +32,4 @@ static inline const struct iommu_ops *of_iommu_configure(struct device *dev,#endif /* CONFIG_OF_IOMMU */ -extern struct of_device_id __iommu_of_table; - -#define IOMMU_OF_DECLARE (name, compat) OF_DECLARE_1(iommu, name, compat, NULL) -#endif /* __OF_IOMMU_H */
Signature · 1 line
2.17.1
Rob Herring
maintainerPATCH v4 6/6 PM / Domains: Stop deferring probe at the end of initcall
In reply to Rob HerringAll PM domain drivers must be built-in (at least those using DT), so there is no point deferring probe after initcalls are done. Continuing to defer probe may prevent booting successfully even if managing PM domains is not required. This can happen if the user failed to enable the driver or if power-domains are added to a platform's DT, but there is not yet a driver (e.g. a new DTB with an old kernel).
Call the driver core function driver_deferred_probe_check_init_done() instead of just returning -EPROBE_DEFER to stop deferring probe when initcalls are done.
---
v4:
- Add Rafael's ack
v3:
- Update to new function name
drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/domain.c +1 -1
@@ -2253,7 +2253,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np,mutex_unlock (&gpd_list_lock);dev_dbg (dev,"%s() failed to find PM domain: %ld\n" , __func__,PTR_ERR (pd)); -return -EPROBE_DEFER ; +return driver_deferred_probe_check_state (dev); }dev_dbg (dev,"adding to PM domain %s\n" , pd->name);
--
2.17.1
Re: [PATCH v4 6/6] PM / Domains: Stop deferring probe at the end of initcall
Quoted 34 lines · Rob Herring
All PM domain drivers must be built-in (at least those using DT), so there is no point deferring probe after initcalls are done. Continuing to defer probe may prevent booting successfully even if managing PM domains is not required. This can happen if the user failed to enable the driver or if power-domains are added to a platform's DT, but there is not yet a driver (e.g. a new DTB with an old kernel).
Call the driver core function
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER to stop deferring probe when initcalls are done.Cc Kevin Hilman <[email protected]>Cc Ulf Hansson <[email protected]>Cc Pavel Machek <[email protected]>Cc Len Brown <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc linux-pm at vger.kernel.orgSigned-off-by Rob Herring <[email protected]>---
v4:
- Add Rafael's ackv3:
- Update to new function namedrivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/base/power/domain.c +0
-0
drivers/base/power/domain.c static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, · line 2257
Quoted 6 lines
drivers/base/power/domain.c +1
-1@@ -2253,7 +2253,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np,mutex_unlock (&gpd_list_lock);dev_dbg (dev,"%s() failed to find PM domain: %ld\n" , __func__,PTR_ERR (pd)); -return -EPROBE_DEFER ; +return driver_deferred_probe_check_state (dev); }
This isn't the only error path where -EPROBE_DEFER may be returned during attach in genpd.
Have a look at the callers of __genpd_dev_pm_attach() and also have a second look inside __genpd_dev_pm_attach() itself. And in Rafael's tree.
Quoted 4 lines
drivers/base/power/domain.c +0
-1dev_dbg (dev,"adding to PM domain %s\n" , pd->name); --2.17.1
Besides the above, I am fine with the approach as such.
Kind regards
Uffe
Rob Herring
maintainerRe: [PATCH v4 6/6] PM / Domains: Stop deferring probe at the end of initcall
Quoted 31 lines · Ulf Hansson
Quoted 29 lines · Rob Herring
All PM domain drivers must be built-in (at least those using DT), so there is no point deferring probe after initcalls are done. Continuing to defer probe may prevent booting successfully even if managing PM domains is not required. This can happen if the user failed to enable the driver or if power-domains are added to a platform's DT, but there is not yet a driver (e.g. a new DTB with an old kernel).
Call the driver core function
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER to stop deferring probe when initcalls are done.Cc Kevin Hilman <[email protected]>Cc Ulf Hansson <[email protected]>Cc Pavel Machek <[email protected]>Cc Len Brown <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc linux-pm at vger.kernel.orgSigned-off-by Rob Herring <[email protected]>---
v4:
- Add Rafael's ackv3:
- Update to new function namedrivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
drivers/base/power/domain.c static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, · line 2257
Quoted 11 lines
drivers/base/power/domain.c +1
-1@@ -2253,7 +2253,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np,mutex_unlock (&gpd_list_lock);dev_dbg (dev,"%s() failed to find PM domain: %ld\n" , __func__,PTR_ERR (pd)); -return -EPROBE_DEFER ; +return driver_deferred_probe_check_state (dev); }This isn't the only error path where -EPROBE_DEFER may be returned during attach in genpd.
Yes, but I think this is the only place you can fail to get the PD device from DT. The case we care about is properties exist in the DT, but no driver exists.
What would cause deferring in the latter cases?
Rob
Re: [PATCH v4 6/6] PM / Domains: Stop deferring probe at the end of initcall
Quoted 47 lines · Rob Herring
Quoted 31 lines · Ulf Hansson
Quoted 29 lines · Rob Herring
All PM domain drivers must be built-in (at least those using DT), so there is no point deferring probe after initcalls are done. Continuing to defer probe may prevent booting successfully even if managing PM domains is not required. This can happen if the user failed to enable the driver or if power-domains are added to a platform's DT, but there is not yet a driver (e.g. a new DTB with an old kernel).
Call the driver core function
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER to stop deferring probe when initcalls are done.Cc Kevin Hilman <[email protected]>Cc Ulf Hansson <[email protected]>Cc Pavel Machek <[email protected]>Cc Len Brown <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc linux-pm at vger.kernel.orgSigned-off-by Rob Herring <[email protected]>---
v4:
- Add Rafael's ackv3:
- Update to new function namedrivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
drivers/base/power/domain.c static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, · line 2257
Quoted 11 lines
drivers/base/power/domain.c +1
-1@@ -2253,7 +2253,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np,mutex_unlock (&gpd_list_lock);dev_dbg (dev,"%s() failed to find PM domain: %ld\n" , __func__,PTR_ERR (pd)); -return -EPROBE_DEFER ; +return driver_deferred_probe_check_state (dev); }This isn't the only error path where -EPROBE_DEFER may be returned during attach in genpd.
Quoted 3 lines
Yes, but I think this is the only place you can fail to get the PD device from DT. The case we care about is properties exist in the DT, but no driver exists.
That's correct. Thanks for clarifying!
Quoted 2 lines
What would cause deferring in the latter cases?
To power on the PM domain for example, which often is required to be able to probe the device.
Quoted 2 lines
Rob
Kind regards
Uffe