Skip to contentSkip to conversation

deferred_probe_timeout logic clean up

RFC PATCH Superseded Saravana Kannan 5 participants 22 messages May 26, 2022 – Jun 7, 2022

Subsystems (13)
Networking Network drivers ACPI GPIO +9 more subsystems

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover deferred_probe_timeout logic clean up

This series is based on linux-next + these 2 small patches applies on top:
https://lore.kernel.org/lkml/[email protected]/

A lot of the deferred_probe_timeout logic is redundant with fw_devlink=on. Also, enabling deferred_probe_timeout by default breaks a few cases.

This series tries to delete the redundant logic, simplify the frameworks that use driver_deferred_probe_check_state(), enable deferred_probe_timeout=10 by default, and fixes the nfsroot failure case.

Patches 1 to 3 are fairly straightforward and can probably be applied right away.

Patches 4 to 9 are related and are the complicated bits of this series.

Patch 8 is where someone with more knowledge of the IP auto config code can help rewrite the patch to limit the scope of the workaround by running the work around only if IP auto config fails the first time around. But it's also something that can be optimized in the future because it's already limited to the case where IP auto config is enabled using the kernel commandline.

Yoshihiro/Geert,

If you can test this patch series and confirm that the NFS root case works, I'd really appreciate that.

Cc Mark Brown <[email protected]>
Cc Rob Herring <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Yoshihiro Shimoda <[email protected]>
Cc John Stultz <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Sebastian Andrzej Siewior <[email protected]>

Saravana Kannan (9):
PM: domains: Delete usage of driver_deferred_probe_check_state()
pinctrl: devicetree: Delete usage of driver_deferred_probe_check_state()
net: mdio: Delete usage of driver_deferred_probe_check_state() Revert "driver core: Set default deferred_probe_timeout back to 0." driver core: Set fw_devlink.strict=1 by default
iommu/of: Delete usage of driver_deferred_probe_check_state() driver core: Add fw_devlink_unblock_may_probe() helper function
net: ipconfig: Force fw_devlink to unblock any devices that might probe driver core: Delete driver_deferred_probe_check_state()

 drivers/base/base.h            |  1 +
 drivers/base/core.c            | 60 +++++++++++++++++++++++++++++++++-
 drivers/base/dd.c              | 37 ++++-----------------
 drivers/base/power/domain.c    |  2 +-
 drivers/iommu/of_iommu.c       |  2 +-
 drivers/net/mdio/fwnode_mdio.c |  4 +--
 drivers/pinctrl/devicetree.c   |  2 +-
 include/linux/device/driver.h  |  1 -
 include/linux/fwnode.h         |  2 ++
 net/ipv4/ipconfig.c            |  2 ++
 10 files changed, 74 insertions(+), 39 deletions(-)
Signature · 1 line
2.36.1.124.g0e6072fb45-goog
#1 lore raw

RFC PATCH 1/9 PM: domains: Delete usage of driver_deferred_probe_check_state()

Now that fw_devlink=on by default and fw_devlink supports "power-domains" property, the execution will never get to the point where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired.

So, delete the call and replace it with -ENODEV.

---
 drivers/base/power/domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/domain.c +1 -1
index 739e52cd4aba..3e86772d5fac 100644
@@ -2730,7 +2730,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
 		mutex_unlock(&gpd_list_lock);
 		dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
 			__func__, PTR_ERR(pd));
-		return driver_deferred_probe_check_state(base_dev);
+		return -ENODEV;
 	}
 
 	dev_dbg(dev, "adding to PM domain %s\n", pd->name);
Signature · 6 lines
2.36.1.124.g0e6072fb45-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#2 lore raw

RFC PATCH 2/9 pinctrl: devicetree: Delete usage of driver_deferred_probe_check_state()

In reply to Saravana Kannan

Now that fw_devlink=on by default and fw_devlink supports "pinctrl-[0-8]" property, the execution will never get to the point where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired.

So, delete the call and replace it with -ENODEV.

---
 drivers/pinctrl/devicetree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/devicetree.c +1 -1
index 3fb238714718..ef898ee8ca6b 100644
@@ -129,7 +129,7 @@ static int dt_to_map_one_config(struct pinctrl *p,
 		np_pctldev = of_get_next_parent(np_pctldev);
 		if (!np_pctldev || of_node_is_root(np_pctldev)) {
 			of_node_put(np_pctldev);
-			ret = driver_deferred_probe_check_state(p->dev);
+			ret = -ENODEV;
 			/* keep deferring if modules are enabled */
 			if (IS_ENABLED(CONFIG_MODULES) && !allow_default && ret < 0)
 				ret = -EPROBE_DEFER;
Signature · 6 lines
2.36.1.124.g0e6072fb45-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#6 lore raw

RFC PATCH 3/9 net: mdio: Delete usage of driver_deferred_probe_check_state()

In reply to Saravana Kannan

Now that fw_devlink=on by default and fw_devlink supports interrupt properties, the execution will never get to the point where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired.

So, delete the call and replace it with -ENODEV.

---
 drivers/net/mdio/fwnode_mdio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/mdio/fwnode_mdio.c +1 -3
index 1c1584fca632..3e79c2c51929 100644
@@ -47,9 +47,7 @@ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
 	 * just fall back to poll mode
 	 */
 	if (rc == -EPROBE_DEFER)
-		rc = driver_deferred_probe_check_state(&phy->mdio.dev);
-	if (rc == -EPROBE_DEFER)
-		return rc;
+		rc = -ENODEV;
 
 	if (rc > 0) {
 		phy->irq = rc;
Signature · 6 lines
2.36.1.124.g0e6072fb45-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#7 lore raw

RFC PATCH 4/9 Revert "driver core: Set default deferred_probe_timeout back to 0."

In reply to Saravana Kannan

This reverts commit 11f7e7ef553b6b93ac1aa74a3c2011b9cc8aeb61.

Let's take another shot at getting deferred_probe_timeout=10 to work.

---
 drivers/base/dd.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/base/dd.c +5 -0
index 11b0fb6414d3..f963d9010d7f 100644
@@ -256,7 +256,12 @@ static int deferred_devs_show(struct seq_file *s, void *data)
 }
 DEFINE_SHOW_ATTRIBUTE(deferred_devs);
 
+#ifdef CONFIG_MODULES
+int driver_deferred_probe_timeout = 10;
+#else
 int driver_deferred_probe_timeout;
+#endif
+
 EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout);
 
 static int __init deferred_probe_timeout_setup(char *str)
Signature · 6 lines
2.36.1.124.g0e6072fb45-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#11 lore raw

RFC PATCH 5/9 driver core: Set fw_devlink.strict=1 by default

In reply to Saravana Kannan

Now that deferred_probe_timeout is non-zero by default, fw_devlink will never permanently block the probing of devices. It'll try its best to probe the devices in the right order and then finally let devices probe even if their suppliers don't have any drivers.

---
 drivers/base/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/core.c +1 -1
index 7cd789c4985d..7672f23231c1 100644
@@ -1581,7 +1581,7 @@ static int __init fw_devlink_setup(char *arg)
 }
 early_param("fw_devlink", fw_devlink_setup);
 
-static bool fw_devlink_strict;
+static bool fw_devlink_strict = true;
 static int __init fw_devlink_strict_setup(char *arg)
 {
 	return strtobool(arg, &fw_devlink_strict);
Signature · 6 lines
2.36.1.124.g0e6072fb45-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#12 lore raw

RFC PATCH 6/9 iommu/of: Delete usage of driver_deferred_probe_check_state()

In reply to Saravana Kannan

Now that fw_devlink=on and fw_devlink.strict=1 by default and fw_devlink supports iommu DT properties, the execution will never get to the point where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired.

So, delete the call and replace it with -ENODEV.

---
 drivers/iommu/of_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/of_iommu.c +1 -1
index 5696314ae69e..41f4eb005219 100644
@@ -40,7 +40,7 @@ static int of_iommu_xlate(struct device *dev,
 	 * a proper probe-ordering dependency mechanism in future.
 	 */
 	if (!ops)
-		return driver_deferred_probe_check_state(dev);
+		return -ENODEV;
 
 	if (!try_module_get(ops->owner))
 		return -ENODEV;
Signature · 6 lines
2.36.1.124.g0e6072fb45-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#13 lore raw

RFC PATCH 7/9 driver core: Add fw_devlink_unblock_may_probe() helper function

In reply to Saravana Kannan

This function can be used during the kernel boot sequence to forcefully override fw_devlink=on and unblock the probing of all devices that have a driver.

It's mainly meant to be called from late_initcall() or late_initcall_sync() where a device needs to probe before the kernel can mount rootfs.

---
 drivers/base/base.h    |  1 +
 drivers/base/core.c    | 58 ++++++++++++++++++++++++++++++++++++++++++
 drivers/base/dd.c      |  2 +-
 include/linux/fwnode.h |  2 ++
 4 files changed, 62 insertions(+), 1 deletion(-)
drivers/base/base.h +1 -0
index ab71403d102f..b3a43a164dcd 100644
@@ -160,6 +160,7 @@ extern int devres_release_all(struct device *dev);
 extern void device_block_probing(void);
 extern void device_unblock_probing(void);
 extern void deferred_probe_extend_timeout(void);
+extern void driver_deferred_probe_trigger(void);
 
 /* /sys/devices directory */
 extern struct kset *devices_kset;
drivers/base/core.c +58 -0

64 lines not on this page · raw message

drivers/base/dd.c +1 -1
index f963d9010d7f..af8138d44e6c 100644
@@ -172,7 +172,7 @@ static bool driver_deferred_probe_enable;
  * changes in the midst of a probe, then deferred processing should be triggered
  * again.
  */
-static void driver_deferred_probe_trigger(void)
+void driver_deferred_probe_trigger(void)
 {
 	if (!driver_deferred_probe_enable)
 		return;
include/linux/fwnode.h +2 -0
index 9a81c4410b9f..0770edda7068 100644
@@ -13,6 +13,7 @@
 #include <linux/list.h>
 #include <linux/bits.h>
 #include <linux/err.h>
+#include <linux/init.h>
 
 struct fwnode_operations;
 struct device;
@@ -199,5 +200,6 @@ extern bool fw_devlink_is_strict(void);
 int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup);
 void fwnode_links_purge(struct fwnode_handle *fwnode);
 void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode);
+void __init fw_devlink_unblock_may_probe(void);
 
 #endif
Signature · 6 lines
2.36.1.124.g0e6072fb45-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#15 lore raw

RFC PATCH 8/9 net: ipconfig: Force fw_devlink to unblock any devices that might probe

In reply to Saravana Kannan

If there are network devices that could probe without some of their suppliers probing and those network devices are needed for IP auto config to work, then fw_devlink=on might break that usecase by blocking the network devices from probing by the time IP auto config starts.

So, when IP auto config is enabled, make sure fw_devlink doesn't block the probing of any device that has a driver by the time we get to IP auto config.

---
 net/ipv4/ipconfig.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/ipconfig.c +2 -0
index 9d41d5d5cd1e..aa7b8ba68ca6 100644
@@ -1435,6 +1435,8 @@ static int __init wait_for_devices(void)
 {
 	int i;
 
+	fw_devlink_unblock_may_probe();
+
 	for (i = 0; i < DEVICE_WAIT_MAX; i++) {
 		struct net_device *dev;
 		int found = 0;
Signature · 6 lines
2.36.1.124.g0e6072fb45-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#17 lore raw

RFC PATCH 9/9 driver core: Delete driver_deferred_probe_check_state()

In reply to Saravana Kannan

The function is no longer used. So delete it.

---
 drivers/base/dd.c             | 30 ------------------------------
 include/linux/device/driver.h |  1 -
 2 files changed, 31 deletions(-)
drivers/base/dd.c +0 -30
index af8138d44e6c..789b0871dc45 100644
@@ -274,42 +274,12 @@ static int __init deferred_probe_timeout_setup(char *str)
 }
 __setup("deferred_probe_timeout=", deferred_probe_timeout_setup);
 
-/**
- * driver_deferred_probe_check_state() - Check deferred probe state
- * @dev: device to check
- *
- * Return:
- * * -ENODEV if initcalls have completed and modules are disabled.
- * * -ETIMEDOUT if the deferred probe timeout was set and has expired
- *   and modules are enabled.
- * * -EPROBE_DEFER in other cases.
- *
- * Drivers or subsystems can opt-in to calling this function instead of directly
- * returning -EPROBE_DEFER.
- */
-int driver_deferred_probe_check_state(struct device *dev)
-{
-	if (!IS_ENABLED(CONFIG_MODULES) && initcalls_done) {
-		dev_warn(dev, "ignoring dependency for device, assuming no driver\n");
-		return -ENODEV;
-	}
-
-	if (!driver_deferred_probe_timeout && initcalls_done) {
-		dev_warn(dev, "deferred probe timeout, ignoring dependency\n");
-		return -ETIMEDOUT;
-	}
-
-	return -EPROBE_DEFER;
-}
-EXPORT_SYMBOL_GPL(driver_deferred_probe_check_state);
-
 static void deferred_probe_timeout_work_func(struct work_struct *work)
 {
 	struct device_private *p;
 
 	fw_devlink_drivers_done();
 
-	driver_deferred_probe_timeout = 0;
 	driver_deferred_probe_trigger();
 	flush_work(&deferred_probe_work);
 
include/linux/device/driver.h +0 -1
index 700453017e1c..7c245d269feb 100644
@@ -241,7 +241,6 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev)
 
 extern int driver_deferred_probe_timeout;
 void driver_deferred_probe_add(struct device *dev);
-int driver_deferred_probe_check_state(struct device *dev);
 void driver_init(void);
 
 /**
Signature · 6 lines
2.36.1.124.g0e6072fb45-goog

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#18 lore raw
In reply to Saravana Kannan
Quoted 1 line · Saravana Kannan

Yoshihiro/Geert,

Hi Saravana,

Quoted 2 lines

If you can test this patch series and confirm that the NFS root case works, I'd really appreciate that.

The two patches you sent earlier, plus this series, plus

drivers/base/core.c +0 -2
index 7ff7fbb006431..829d9b1f7403f 100644
@@ -1697,8 +1697,6 @@ static int fw_devlink_may_probe(struct device *dev, void *data)
  */
 void __init fw_devlink_unblock_may_probe(void)
 {
-	struct device_link *link, *ln;
-
 	if (!fw_devlink_flags || fw_devlink_is_permissive())
 		return;
 

and it compiles + boots without a delay.

Sebastian

#8 lore raw

Re: [RFC PATCH v1 4/9] Revert "driver core: Set default deferred_probe_timeout back to 0."

In reply to Saravana Kannan

Hi Saravana,

Quoted 1 line · Saravana Kannan

This reverts commit 11f7e7ef553b6b93ac1aa74a3c2011b9cc8aeb61.

scripts/chdeckpatch.pl says:

WARNING: Unknown commit id
'11f7e7ef553b6b93ac1aa74a3c2011b9cc8aeb61', maybe rebased or not pulled?

I assume this is your local copy of
https://lore.kernel.org/r/[email protected]?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw

Re: [RFC PATCH v1 2/9] pinctrl: devicetree: Delete usage of driver_deferred_probe_check_state()

In reply to Saravana Kannan

Hi Saravana,

Thanks for your patch!

Quoted 2 lines · Saravana Kannan

Now that fw_devlink=on by default and fw_devlink supports "pinctrl-[0-8]" property, the execution will never get to the point

0-9?

oh, it's really 0-8:

drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl1, "pinctrl-1", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl2, "pinctrl-2", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl3, "pinctrl-3", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl4, "pinctrl-4", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl5, "pinctrl-5", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl6, "pinctrl-6", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL)

Looks fragile, especially since we now have:

    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi:
pinctrl-9 = <&i2cmux_9>;
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi: pinctrl-10
= <&i2cmux_10>;
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi: pinctrl-11
= <&i2cmux_11>;
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi: pinctrl-12

= <&i2cmux_pins_i>;

Quoted 6 lines

where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired.

So, delete the call and replace it with -ENODEV.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Tested-by on the v1 series
#20 lore raw
In reply to Saravana Kannan

Hi Saravana,

Quoted 15 lines · Saravana Kannan

This series is based on linux-next + these 2 small patches applies on top:
https://lore.kernel.org/lkml/[email protected]/

A lot of the deferred_probe_timeout logic is redundant with fw_devlink=on. Also, enabling deferred_probe_timeout by default breaks a few cases.

This series tries to delete the redundant logic, simplify the frameworks that use driver_deferred_probe_check_state(), enable deferred_probe_timeout=10 by default, and fixes the nfsroot failure case.

Patches 1 to 3 are fairly straightforward and can probably be applied right away.

Quoted 8 lines

Patches 4 to 9 are related and are the complicated bits of this series.

Patch 8 is where someone with more knowledge of the IP auto config code can help rewrite the patch to limit the scope of the workaround by running the work around only if IP auto config fails the first time around. But it's also something that can be optimized in the future because it's already limited to the case where IP auto config is enabled using the kernel commandline.

Thanks for your series!

Quoted 4 lines

Yoshihiro/Geert,

If you can test this patch series and confirm that the NFS root case works, I'd really appreciate that.

On Salvator-XS, Micrel KSZ9031 Gigabit PHY probe is no longer delayed by 9s after applying the two earlier patches, and the same is true after applying this series on top.

I will do testing on more boards, but that may take a while, as we're in the middle of the merge window.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

#14 lore raw

Re: [RFC PATCH v1 7/9] driver core: Add fw_devlink_unblock_may_probe() helper function

In reply to Saravana Kannan
Quoted 8 lines · Saravana Kannan

This function can be used during the kernel boot sequence to forcefully override fw_devlink=on and unblock the probing of all devices that have a driver.

It's mainly meant to be called from late_initcall() or late_initcall_sync() where a device needs to probe before the kernel can mount rootfs.

...

Quoted 13 lines
include/linux/fwnode.h +1 -0
index 9a81c4410b9f..0770edda7068 100644
@@ -13,6 +13,7 @@
 #include <linux/list.h>
 #include <linux/bits.h>
 #include <linux/err.h>
+#include <linux/init.h>
 
 struct fwnode_operations;
 struct device;

include/linux/fwnode.h extern bool fw_devlink_is_strict(void); · line 203

Quoted 4 lines
include/linux/fwnode.h +1 -0
@@ -199,5 +200,6 @@ extern bool fw_devlink_is_strict(void);
 int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup);
 void fwnode_links_purge(struct fwnode_handle *fwnode);
 void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode);
+void __init fw_devlink_unblock_may_probe(void);

I don't think you need init.h and __init here. Important is that you have it in the C-file. Am I wrong?

Signature · 6 lines
With Best Regards,
Andy Shevchenko
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#9 lore raw

Re: [RFC PATCH v1 4/9] Revert "driver core: Set default deferred_probe_timeout back to 0."

In reply to Geert Uytterhoeven
Quoted 6 lines · Geert Uytterhoeven

Hi Saravana,

Quoted 1 line · Saravana Kannan

This reverts commit 11f7e7ef553b6b93ac1aa74a3c2011b9cc8aeb61.

Quoted 8 lines

scripts/chdeckpatch.pl says:

WARNING: Unknown commit id
'11f7e7ef553b6b93ac1aa74a3c2011b9cc8aeb61', maybe rebased or not pulled?

I assume this is your local copy of
https://lore.kernel.org/r/[email protected]?

I somehow missed all your replies and noticed it just now.

That commit should be based on driver-core-next.

-Saravana

Quoted 15 lines

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

--
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

#4 lore raw

Re: [RFC PATCH v1 2/9] pinctrl: devicetree: Delete usage of driver_deferred_probe_check_state()

In reply to Geert Uytterhoeven
Quoted 25 lines · Geert Uytterhoeven

Hi Saravana,

Thanks for your patch!

Quoted 2 lines · Saravana Kannan

Now that fw_devlink=on by default and fw_devlink supports "pinctrl-[0-8]" property, the execution will never get to the point

0-9?

oh, it's really 0-8:

drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl1, "pinctrl-1", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl2, "pinctrl-2", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl3, "pinctrl-3", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl4, "pinctrl-4", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl5, "pinctrl-5", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl6, "pinctrl-6", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL)

Looks fragile, especially since we now have:

Quoted 8 lines
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi:
pinctrl-9 = <&i2cmux_9>;
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi: pinctrl-10
= <&i2cmux_10>;
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi: pinctrl-11
= <&i2cmux_11>;
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi: pinctrl-12

= <&i2cmux_pins_i>;

Checking for pinctrl-* and then verifying if * matches %d would be more complicated and probably more expensive compared to listing pinctrl-[0-8]. Especially because more than 50% of pinctrl-* properties in DT files are NOT pinctrl-%d. So back when we merged this, Rob and I agreed [0-8] was good enough for now and we can add more if we needed to. Also, when I checked back then, all the pinctrl-5+ properties ended up pointing to the same suppliers as the lower numbered ones. So it didn't make a difference.

Ok, I just checked linux-next all the pinctrl-9+ instances and it's still true that they all point to the same supplier pointed to by pinctrl-[0-8].

So yeah, it looks fragile, but is not broken and it's more efficient than looking for pinctrl-%d or adding more pinctrl-xx entries. So, let's fix it if it actually breaks? Not going to oppose a patch if anyone wants to make it more complete.

-Saravana

Quoted 18 lines
Quoted 7 lines

where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired.

So, delete the call and replace it with -ENODEV.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#19 lore raw
In reply to Sebastian Andrzej Siewior
Quoted 23 lines · Sebastian Andrzej Siewior
Quoted 1 line · Saravana Kannan

Yoshihiro/Geert,

Hi Saravana,

Quoted 2 lines

If you can test this patch series and confirm that the NFS root case works, I'd really appreciate that.

The two patches you sent earlier, plus this series, plus

drivers/base/core.c +0 -2
index 7ff7fbb006431..829d9b1f7403f 100644
@@ -1697,8 +1697,6 @@ static int fw_devlink_may_probe(struct device *dev, void *data)
  */
 void __init fw_devlink_unblock_may_probe(void)
 {
-       struct device_link *link, *ln;
-
        if (!fw_devlink_flags || fw_devlink_is_permissive())
                return;
 
Quoted 1 line

and it compiles + boots without a delay.

Thanks for testing! I missed your reply until now and I ended up sending out a v2 a few days back. That's a much better series IMO because it only temporarily ignores dependencies and only when NFS root mounting might not work. If you can test that too (and it shouldn't have the useless variable), I'd appreciate it.

-Saravana

#21 lore raw
In reply to Geert Uytterhoeven
Quoted 35 lines · Geert Uytterhoeven

Hi Saravana,

Quoted 15 lines · Saravana Kannan

This series is based on linux-next + these 2 small patches applies on top:
https://lore.kernel.org/lkml/[email protected]/

A lot of the deferred_probe_timeout logic is redundant with fw_devlink=on. Also, enabling deferred_probe_timeout by default breaks a few cases.

This series tries to delete the redundant logic, simplify the frameworks that use driver_deferred_probe_check_state(), enable deferred_probe_timeout=10 by default, and fixes the nfsroot failure case.

Patches 1 to 3 are fairly straightforward and can probably be applied right away.

Quoted 8 lines

Patches 4 to 9 are related and are the complicated bits of this series.

Patch 8 is where someone with more knowledge of the IP auto config code can help rewrite the patch to limit the scope of the workaround by running the work around only if IP auto config fails the first time around. But it's also something that can be optimized in the future because it's already limited to the case where IP auto config is enabled using the kernel commandline.

Thanks for your series!

Quoted 4 lines

Yoshihiro/Geert,

If you can test this patch series and confirm that the NFS root case works, I'd really appreciate that.

Quoted 7 lines

On Salvator-XS, Micrel KSZ9031 Gigabit PHY probe is no longer delayed by 9s after applying the two earlier patches, and the same is true after applying this series on top.

I will do testing on more boards, but that may take a while, as we're in the middle of the merge window.

Thanks for testing. I missed your email until now. I sent out a v2 series a few days back and that's a much better solution than v1. If you can test that series instead, that'd be nice.

-Saravana
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

#10 lore raw

Re: [RFC PATCH v1 4/9] Revert "driver core: Set default deferred_probe_timeout back to 0."

In reply to Saravana Kannan
Quoted 14 lines · Saravana Kannan
Quoted 12 lines · Geert Uytterhoeven

Hi Saravana,

Quoted 1 line · Saravana Kannan

This reverts commit 11f7e7ef553b6b93ac1aa74a3c2011b9cc8aeb61.

scripts/chdeckpatch.pl says:

WARNING: Unknown commit id
'11f7e7ef553b6b93ac1aa74a3c2011b9cc8aeb61', maybe rebased or not pulled?

Quoted 6 lines
Quoted 2 lines

I assume this is your local copy of
https://lore.kernel.org/r/[email protected]?

I somehow missed all your replies and noticed it just now.

That commit should be based on driver-core-next.

My bad, it was indeed a local commit, but it's one I had already sent to LKML. It's one of the 2 patches I asked to pull-in in the cover letter. I'll fix this once I get some tests/reviews on this series or if I need to send out a v3 series before that.

-Saravana

#5 lore raw

Re: [RFC PATCH v1 2/9] pinctrl: devicetree: Delete usage of driver_deferred_probe_check_state()

In reply to Saravana Kannan
Quoted 39 lines · Saravana Kannan
Quoted 20 lines · Geert Uytterhoeven
Quoted 2 lines · Saravana Kannan

Now that fw_devlink=on by default and fw_devlink supports "pinctrl-[0-8]" property, the execution will never get to the point

0-9?

oh, it's really 0-8:

drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl1, "pinctrl-1", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl2, "pinctrl-2", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl3, "pinctrl-3", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl4, "pinctrl-4", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl5, "pinctrl-5", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl6, "pinctrl-6", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL) drivers/of/property.c:DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL)

Looks fragile, especially since we now have:

Quoted 8 lines
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi:
pinctrl-9 = <&i2cmux_9>;
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi: pinctrl-10
= <&i2cmux_10>;
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi: pinctrl-11
= <&i2cmux_11>;
    arch/arm64/boot/dts/microchip/sparx5_pcb134_board.dtsi: pinctrl-12

= <&i2cmux_pins_i>;

Checking for pinctrl-* and then verifying if * matches %d would be more complicated and probably more expensive compared to listing pinctrl-[0-8]. Especially because more than 50% of pinctrl-* properties in DT files are NOT pinctrl-%d. So back when we merged this, Rob and I agreed [0-8] was good enough for now and we can add more if we needed to. Also, when I checked back then, all the pinctrl-5+ properties ended up pointing to the same suppliers as the lower numbered ones. So it didn't make a difference.

Quoted 5 lines

Ok, I just checked linux-next all the pinctrl-9+ instances and it's still true that they all point to the same supplier pointed to by pinctrl-[0-8].

So yeah, it looks fragile,

And feels fragile, adds into confusion, etc. Please, consider redesigning this to be more robust.

Quoted 9 lines

but is not broken and it's more efficient
than looking for pinctrl-%d or adding more pinctrl-xx entries. So, let's fix it if it actually breaks? Not going to oppose a patch if anyone wants to make it more complete.

Quoted 4 lines
Quoted 4 lines

where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired.

So, delete the call and replace it with -ENODEV.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#16 lore raw

Re: [RFC PATCH v1 8/9] net: ipconfig: Force fw_devlink to unblock any devices that might probe

In reply to Saravana Kannan

Hi Saravana,

Quoted 19 lines · Saravana Kannan

If there are network devices that could probe without some of their suppliers probing and those network devices are needed for IP auto config to work, then fw_devlink=on might break that usecase by blocking the network devices from probing by the time IP auto config starts.

So, when IP auto config is enabled, make sure fw_devlink doesn't block the probing of any device that has a driver by the time we get to IP auto config.

---
 net/ipv4/ipconfig.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/ipconfig.c +0 -0
index 9d41d5d5cd1e..aa7b8ba68ca6 100644

net/ipv4/ipconfig.c static int __init wait_for_devices(void) · line 1442

Quoted 8 lines
net/ipv4/ipconfig.c +2 -0
@@ -1435,6 +1435,8 @@ static int __init wait_for_devices(void)
 {
        int i;
 
+       fw_devlink_unblock_may_probe();
+
        for (i = 0; i < DEVICE_WAIT_MAX; i++) {
                struct net_device *dev;
                int found = 0;

FTR, this lacks an include <linux/fwnode.h>, as my mips rbtx4927 build fails with:

net/ipv4/ipconfig.c:1438:2: error: implicit declaration of function ‘fw_devlink_unblock_may_probe’ [-Werror=implicit-function-declaration]

Switching to v2 instead...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu