Skip to contentSkip to conversation

PCI: dwc: layerscape: convert to builtin_platform_driver()

PATCH Applied Michael Walle 7 participants 30 messages Jan 20, 2021 – Jan 28, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: dwc: layerscape: convert to builtin_platform_driver()

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

Fixes e590474768f1 ("driver core: Set fw_devlink=on by default")
---
 drivers/pci/controller/dwc/pci-layerscape.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-layerscape.c +3 -2
index 44ad34cdc3bc..5b9c625df7b8 100644
@@ -232,7 +232,7 @@ static const struct of_device_id ls_pcie_of_match[] = {
 	{ },
 };
 
-static int __init ls_pcie_probe(struct platform_device *pdev)
+static int ls_pcie_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct dw_pcie *pci;
@@ -271,10 +271,11 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
 }
 
 static struct platform_driver ls_pcie_driver = {
+	.probe = ls_pcie_probe,
 	.driver = {
 		.name = "layerscape-pcie",
 		.of_match_table = ls_pcie_of_match,
 		.suppress_bind_attrs = true,
 	},
 };
-builtin_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
+builtin_platform_driver(ls_pcie_driver);
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reviewer
#1 lore raw
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed? Then we're not fixing drivers later when folks start caring about deferred probe and devlink.

I'd really prefer if we convert this to a module instead. (And all the other PCI host drivers.)

Quoted 1 line
Fixes e590474768f1 ("driver core: Set fw_devlink=on by default")

This happened!?

Quoted 32 lines
---
 drivers/pci/controller/dwc/pci-layerscape.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-layerscape.c +3 -3
index 44ad34cdc3bc..5b9c625df7b8 100644
@@ -232,7 +232,7 @@ static const struct of_device_id ls_pcie_of_match[] = {
        { },
 };
 
-static int __init ls_pcie_probe(struct platform_device *pdev)
+static int ls_pcie_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct dw_pcie *pci;
@@ -271,10 +271,11 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
 }
 
 static struct platform_driver ls_pcie_driver = {
+       .probe = ls_pcie_probe,
        .driver = {
                .name = "layerscape-pcie",
                .of_match_table = ls_pcie_of_match,
                .suppress_bind_attrs = true,
        },
 };
-builtin_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
+builtin_platform_driver(ls_pcie_driver);
--
Quoted 2 lines

2.20.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw

Am 2021-01-20 15:23, schrieb Rob Herring:

Quoted 6 lines · Michael Walle
Quoted 4 lines

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

Quoted 6 lines

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed? Then we're not fixing drivers later when folks start caring about deferred probe and devlink.

I'd really prefer if we convert this to a module instead. (And all the other PCI host drivers.)

I briefly looked into adding a remove() op. But I don't know what will have to be undo of the ls_pcie_host_init(). That would be up to the maintainers of this driver.

_But_ I'd really like to see PCI working on my board again ;) At least until the end of this development cycle.

-michael

Quoted 27 lines
Quoted 1 line
Fixes e590474768f1 ("driver core: Set fw_devlink=on by default")

This happened!?

Quoted 23 lines
---
 drivers/pci/controller/dwc/pci-layerscape.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-layerscape.c +1 -1
index 44ad34cdc3bc..5b9c625df7b8 100644
@@ -232,7 +232,7 @@ static const struct of_device_id 
 ls_pcie_of_match[] = {
        { },
 };
 
-static int __init ls_pcie_probe(struct platform_device *pdev)
+static int ls_pcie_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct dw_pcie *pci;
drivers/pci/controller/dwc/pci-layerscape.c +0 -0
@@ -271,10 +271,11 @@ static int __init ls_pcie_probe(struct 
 platform_device *pdev)
 }
 
Quoted 13 lines
Quoted 11 lines
drivers/pci/controller/dwc/pci-layerscape.c +2 -2
 static struct platform_driver ls_pcie_driver = {
+       .probe = ls_pcie_probe,
        .driver = {
                .name = "layerscape-pcie",
                .of_match_table = ls_pcie_of_match,
                .suppress_bind_attrs = true,
        },
 };
-builtin_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
+builtin_platform_driver(ls_pcie_driver);
--
Quoted 2 lines

2.20.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
In reply to Rob Herring
Quoted 10 lines · Rob Herring
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed? Then we're not fixing drivers later when folks start caring about deferred probe and devlink.

Quoted 6 lines

I'd really prefer if we convert this to a module instead. (And all the other PCI host drivers.)

Quoted 1 line
Fixes e590474768f1 ("driver core: Set fw_devlink=on by default")

This happened!?

It's in linux-next in my tree, but is looking like it might be reverted soon. But finding these issues is good.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw
In reply to Rob Herring
Quoted 9 lines · Rob Herring
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

-Saravana

Quoted 31 lines

Then we're not fixing drivers later
when folks start caring about deferred probe and devlink.

I'd really prefer if we convert this to a module instead. (And all the other PCI host drivers.)

Quoted 1 line
Fixes e590474768f1 ("driver core: Set fw_devlink=on by default")

This happened!?

Quoted 21 lines
---
 drivers/pci/controller/dwc/pci-layerscape.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-layerscape.c +1 -1
index 44ad34cdc3bc..5b9c625df7b8 100644
@@ -232,7 +232,7 @@ static const struct of_device_id ls_pcie_of_match[] = {
        { },
 };
 
-static int __init ls_pcie_probe(struct platform_device *pdev)
+static int ls_pcie_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct dw_pcie *pci;
@@ -271,10 +271,11 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
 }
 
Quoted 13 lines
Quoted 11 lines
drivers/pci/controller/dwc/pci-layerscape.c +2 -2
 static struct platform_driver ls_pcie_driver = {
+       .probe = ls_pcie_probe,
        .driver = {
                .name = "layerscape-pcie",
                .of_match_table = ls_pcie_of_match,
                .suppress_bind_attrs = true,
        },
 };
-builtin_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
+builtin_platform_driver(ls_pcie_driver);
--
Quoted 2 lines

2.20.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 19 lines · Rob Herring
Quoted 9 lines · Michael Walle
Quoted 4 lines

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20
Quoted 7 lines

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

-michael

#6 lore raw
In reply to Saravana Kannan

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 19 lines · Rob Herring
Quoted 9 lines · Michael Walle
Quoted 4 lines

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20
Quoted 7 lines

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

-michael

#7 lore raw
Quoted 28 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 23 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Quoted 7 lines
Quoted 4 lines

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

-Saravana

#8 lore raw
Quoted 35 lines · Saravana Kannan
Quoted 33 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 27 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

Quoted 9 lines
Quoted 2 lines

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

And thanks for agreeing to help!

-Saravana

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#9 lore raw
In reply to Saravana Kannan

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 34 lines · Michael Walle
Quoted 33 lines

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 27 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

Quoted 8 lines
Quoted 2 lines

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

-michael

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#10 lore raw
Quoted 40 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 38 lines
Quoted 35 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 20 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20
Quoted 7 lines

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Quoted 8 lines
Quoted 5 lines

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

-Saravana

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#11 lore raw

Hi Saravana,

Quoted 46 lines · Saravana Kannan
Quoted 45 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 43 lines
Quoted 28 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 23 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Quoted 7 lines
Quoted 4 lines

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Quoted 5 lines
Quoted 2 lines

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

And dropping them will increase memory usage.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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
#12 lore raw

Am 2021-01-21 12:01, schrieb Geert Uytterhoeven:

Quoted 49 lines

Hi Saravana,

Quoted 46 lines · Saravana Kannan
Quoted 45 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 43 lines
Quoted 28 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 23 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Quoted 7 lines
Quoted 4 lines

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

And dropping them will increase memory usage.

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

-michael

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#13 lore raw
Quoted 59 lines · Michael Walle

Am 2021-01-21 12:01, schrieb Geert Uytterhoeven:

Quoted 57 lines

Hi Saravana,

Quoted 52 lines · Saravana Kannan
Quoted 39 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 38 lines
Quoted 35 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 20 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20
Quoted 7 lines

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Quoted 8 lines
Quoted 5 lines

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

Quoted 7 lines
Quoted 1 line

And dropping them will increase memory usage.

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

While it's good to drop code that'll not be used past kernel init, the module_platform_driver_probe() is going even more extreme. It doesn't even allow deferred probe (well before kernel init is done). I don't think that behavior is right and that's why we should delete it. Also, I doubt if any of these probe functions even take up 4KB of memory.

-Saravana

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#14 lore raw

Hi Saravana,

Quoted 65 lines · Saravana Kannan
Quoted 56 lines · Michael Walle

Am 2021-01-21 12:01, schrieb Geert Uytterhoeven:

Quoted 55 lines
Quoted 52 lines · Saravana Kannan
Quoted 39 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 38 lines
Quoted 35 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 20 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20
Quoted 7 lines

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Quoted 8 lines
Quoted 5 lines

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

Quoted 7 lines
Quoted 1 line

And dropping them will increase memory usage.

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

Quoted 4 lines

While it's good to drop code that'll not be used past kernel init, the module_platform_driver_probe() is going even more extreme. It doesn't even allow deferred probe (well before kernel init is done). I don't think that behavior is right and that's why we should delete it. Also,

This construct is typically used for builtin hardware for which the dependencies are registered very early, and thus known to probe at first try (if present).

Quoted 1 line

I doubt if any of these probe functions even take up 4KB of memory.

How many 4 KiB pages do you have in a system with 10 MiB of SRAM? How many can you afford to waste?

Gr{oetje,eeting}s,

Geert

Signature · 10 lines
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

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#15 lore raw
Quoted 74 lines · Geert Uytterhoeven

Hi Saravana,

Quoted 65 lines · Saravana Kannan
Quoted 56 lines · Michael Walle

Am 2021-01-21 12:01, schrieb Geert Uytterhoeven:

Quoted 55 lines
Quoted 52 lines · Saravana Kannan
Quoted 39 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 38 lines
Quoted 35 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 20 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20
Quoted 7 lines

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Quoted 8 lines
Quoted 5 lines

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

Quoted 7 lines
Quoted 1 line

And dropping them will increase memory usage.

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

Quoted 4 lines

While it's good to drop code that'll not be used past kernel init, the module_platform_driver_probe() is going even more extreme. It doesn't even allow deferred probe (well before kernel init is done). I don't think that behavior is right and that's why we should delete it. Also,

Quoted 8 lines

This construct is typically used for builtin hardware for which the dependencies are registered very early, and thus known to probe at first try (if present).

Quoted 1 line

I doubt if any of these probe functions even take up 4KB of memory.

How many 4 KiB pages do you have in a system with 10 MiB of SRAM? How many can you afford to waste?

There are only a few instances of this macro in the kernel. How many of those actually fit the description above? We can probably just check the DT?

-Saravana

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#16 lore raw

Hi Saravana,

Quoted 77 lines · Saravana Kannan
Quoted 75 lines · Geert Uytterhoeven
Quoted 65 lines · Saravana Kannan
Quoted 56 lines · Michael Walle

Am 2021-01-21 12:01, schrieb Geert Uytterhoeven:

Quoted 55 lines
Quoted 52 lines · Saravana Kannan
Quoted 39 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 38 lines
Quoted 35 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 20 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20
Quoted 7 lines

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Quoted 8 lines
Quoted 5 lines

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

Quoted 7 lines
Quoted 1 line

And dropping them will increase memory usage.

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

Quoted 4 lines

While it's good to drop code that'll not be used past kernel init, the module_platform_driver_probe() is going even more extreme. It doesn't even allow deferred probe (well before kernel init is done). I don't think that behavior is right and that's why we should delete it. Also,

This construct is typically used for builtin hardware for which the dependencies are registered very early, and thus known to probe at first try (if present).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I doubt if any of these probe functions even take up 4KB of memory.

How many 4 KiB pages do you have in a system with 10 MiB of SRAM? How many can you afford to waste?

There are only a few instances of this macro in the kernel. How many

$ git grep -lw builtin_platform_driver_probe | wc -l
21
$ git grep -lw module_platform_driver_probe | wc -l
86

+ the ones that haven't been converted to the above yet:

$ git grep -lw platform_driver_probe | wc -l
58
Quoted 2 lines

of those actually fit the description above? We can probably just check the DT?

What do you mean by checking the DT?

Gr{oetje,eeting}s,

Geert

Signature · 10 lines
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

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#17 lore raw
Quoted 93 lines · Geert Uytterhoeven

Hi Saravana,

Quoted 77 lines · Saravana Kannan
Quoted 75 lines · Geert Uytterhoeven
Quoted 65 lines · Saravana Kannan
Quoted 56 lines · Michael Walle

Am 2021-01-21 12:01, schrieb Geert Uytterhoeven:

Quoted 55 lines
Quoted 52 lines · Saravana Kannan
Quoted 39 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 38 lines
Quoted 35 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 20 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't
use builtin_platform_driver_probe() because it doesn't retry after probe
deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20
Quoted 7 lines

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Quoted 8 lines
Quoted 5 lines

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

Quoted 7 lines
Quoted 1 line

And dropping them will increase memory usage.

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

Quoted 4 lines

While it's good to drop code that'll not be used past kernel init, the module_platform_driver_probe() is going even more extreme. It doesn't even allow deferred probe (well before kernel init is done). I don't think that behavior is right and that's why we should delete it. Also,

This construct is typically used for builtin hardware for which the dependencies are registered very early, and thus known to probe at first try (if present).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I doubt if any of these probe functions even take up 4KB of memory.

How many 4 KiB pages do you have in a system with 10 MiB of SRAM? How many can you afford to waste?

There are only a few instances of this macro in the kernel. How many

$ git grep -lw builtin_platform_driver_probe | wc -l
21
$ git grep -lw module_platform_driver_probe | wc -l
86
Quoted 5 lines

+ the ones that haven't been converted to the above yet:

$ git grep -lw platform_driver_probe | wc -l
58

Yeah, this adds up in terms of the number of places we'd need to fix. But thinking more about it, a couple of points:
1. Not all builtin_platform_driver_probe() are problems for fw_devlink. So we can just fix them as we go if we need to.

2. The problem with builtin_platform_driver_probe() isn't really with the use of __init. It's the fact that it doesn't allow deferred probes. builtin_platform_driver_probe()/platform_driver_probe() could still be fixed up to allow deferred probe until we get to the point where we free the __init section (so at least till late_initcall).

Quoted 4 lines
Quoted 2 lines

of those actually fit the description above? We can probably just check the DT?

What do you mean by checking the DT?

I was talking about checking the DT to see if the board has very little memory, but that's not always obvious from DT nor does it scale with the number of instances we have. So, ignore this comment.

Anyway, time to get back to actually writing the code to deal with this and other corner cases.

-Saravana

#18 lore raw

Hi Saravana,

Quoted 103 lines · Saravana Kannan
Quoted 90 lines · Geert Uytterhoeven
Quoted 77 lines · Saravana Kannan
Quoted 75 lines · Geert Uytterhoeven
Quoted 65 lines · Saravana Kannan
Quoted 56 lines · Michael Walle

Am 2021-01-21 12:01, schrieb Geert Uytterhoeven:

Quoted 55 lines
Quoted 52 lines · Saravana Kannan
Quoted 39 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 38 lines
Quoted 35 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 20 lines · Rob Herring
Quoted 10 lines

On Wed, Jan 20, 2021 at 4:53 AM Michael Walle <[email protected]>
wrote:

fw_devlink will defer the probe until all suppliers are ready. We can't
use builtin_platform_driver_probe() because it doesn't retry after probe
deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then
shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20
Quoted 7 lines

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Quoted 8 lines
Quoted 5 lines

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

Quoted 7 lines
Quoted 1 line

And dropping them will increase memory usage.

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

Quoted 4 lines

While it's good to drop code that'll not be used past kernel init, the module_platform_driver_probe() is going even more extreme. It doesn't even allow deferred probe (well before kernel init is done). I don't think that behavior is right and that's why we should delete it. Also,

This construct is typically used for builtin hardware for which the dependencies are registered very early, and thus known to probe at first try (if present).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I doubt if any of these probe functions even take up 4KB of memory.

How many 4 KiB pages do you have in a system with 10 MiB of SRAM? How many can you afford to waste?

There are only a few instances of this macro in the kernel. How many

$ git grep -lw builtin_platform_driver_probe | wc -l
21
$ git grep -lw module_platform_driver_probe | wc -l
86
Quoted 5 lines

+ the ones that haven't been converted to the above yet:

$ git grep -lw platform_driver_probe | wc -l
58

Yeah, this adds up in terms of the number of places we'd need to fix. But thinking more about it, a couple of points:
1. Not all builtin_platform_driver_probe() are problems for fw_devlink. So we can just fix them as we go if we need to.

Quoted 5 lines

2. The problem with builtin_platform_driver_probe() isn't really with the use of __init. It's the fact that it doesn't allow deferred probes. builtin_platform_driver_probe()/platform_driver_probe() could still be fixed up to allow deferred probe until we get to the point where we free the __init section (so at least till late_initcall).

That's intentional: it is used for cases that will (must) never be deferred. That's why it's safe to use __init.

Gr{oetje,eeting}s,

Geert

Signature · 10 lines
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

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#19 lore raw
Quoted 107 lines · Geert Uytterhoeven

Hi Saravana,

Quoted 103 lines · Saravana Kannan
Quoted 90 lines · Geert Uytterhoeven
Quoted 77 lines · Saravana Kannan
Quoted 75 lines · Geert Uytterhoeven
Quoted 65 lines · Saravana Kannan
Quoted 56 lines · Michael Walle

Am 2021-01-21 12:01, schrieb Geert Uytterhoeven:

Quoted 55 lines
Quoted 52 lines · Saravana Kannan
Quoted 39 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 38 lines
Quoted 35 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 27 lines · Rob Herring

On Wed, Jan 20, 2021 at 4:53 AM Michael Walle <[email protected]>
wrote:

fw_devlink will defer the probe until all suppliers are ready. We can't
use builtin_platform_driver_probe() because it doesn't retry after probe
deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then
shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing
builtin_platform_driver_probe() to behave like
builtin_platform_driver() is that these probe functions could be
marked with __init. But there are also only 20 instances of
builtin_platform_driver_probe() in the kernel:
$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to
builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Quoted 8 lines
Quoted 5 lines

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

Quoted 7 lines
Quoted 1 line

And dropping them will increase memory usage.

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

Quoted 4 lines

While it's good to drop code that'll not be used past kernel init, the module_platform_driver_probe() is going even more extreme. It doesn't even allow deferred probe (well before kernel init is done). I don't think that behavior is right and that's why we should delete it. Also,

This construct is typically used for builtin hardware for which the dependencies are registered very early, and thus known to probe at first try (if present).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I doubt if any of these probe functions even take up 4KB of memory.

How many 4 KiB pages do you have in a system with 10 MiB of SRAM? How many can you afford to waste?

There are only a few instances of this macro in the kernel. How many

$ git grep -lw builtin_platform_driver_probe | wc -l
21
$ git grep -lw module_platform_driver_probe | wc -l
86
Quoted 5 lines

+ the ones that haven't been converted to the above yet:

$ git grep -lw platform_driver_probe | wc -l
58

Yeah, this adds up in terms of the number of places we'd need to fix. But thinking more about it, a couple of points:
1. Not all builtin_platform_driver_probe() are problems for fw_devlink. So we can just fix them as we go if we need to.

Quoted 8 lines
Quoted 5 lines

2. The problem with builtin_platform_driver_probe() isn't really with the use of __init. It's the fact that it doesn't allow deferred probes. builtin_platform_driver_probe()/platform_driver_probe() could still be fixed up to allow deferred probe until we get to the point where we free the __init section (so at least till late_initcall).

That's intentional: it is used for cases that will (must) never be deferred. That's why it's safe to use __init.

So was the usage of builtin_platform_driver_probe() wrong in the driver Michael fixed? Because, deferring and probing again clearly works?

Also, "must never be deferred" seems like a weird condition to enforce. I think the real "rule" is that if it defers, the platform is not expected to work. But disallowing a probe reattempt seems weird. What is it going to hurt if it's attempted again? At worst it fails one more time?

Also, I'd argue that all/most of the "can't defer, but I'm still a proper struct device" cases are all just patchwork to deal with the fact we were playing initcall chicken when there was no fw_devlink. I'm hoping we can move people away from that mindset. And the first step towards that would be to allow *platform_probe() to allow deferred probes until late_initcall().

-Saravana

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#20 lore raw

Hi Saravana,

Quoted 111 lines · Saravana Kannan
Quoted 110 lines · Geert Uytterhoeven
Quoted 108 lines · Saravana Kannan
Quoted 90 lines · Geert Uytterhoeven
Quoted 77 lines · Saravana Kannan
Quoted 75 lines · Geert Uytterhoeven
Quoted 65 lines · Saravana Kannan
Quoted 56 lines · Michael Walle

Am 2021-01-21 12:01, schrieb Geert Uytterhoeven:

Quoted 55 lines
Quoted 52 lines · Saravana Kannan
Quoted 39 lines · Michael Walle

Am 2021-01-20 20:47, schrieb Saravana Kannan:

Quoted 38 lines
Quoted 35 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted
all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:
On Wed, Jan 20, 2021 at 6:24 AM Rob Herring <[email protected]> wrote:

On Wed, Jan 20, 2021 at 4:53 AM Michael Walle <[email protected]>
wrote:

fw_devlink will defer the probe until all suppliers are ready. We can't
use builtin_platform_driver_probe() because it doesn't retry after probe
deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then
shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing
builtin_platform_driver_probe() to behave like
builtin_platform_driver() is that these probe functions could be
marked with __init. But there are also only 20 instances of
builtin_platform_driver_probe() in the kernel:
$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to
builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and
remove the __init annotations. I could look into that.

Quoted 8 lines
Quoted 5 lines

Yup. That's pretty much it AFAICT.

builtin_platform_driver_probe() also makes sure the driver doesn't ask for async probe, etc. But I doubt anyone is actually setting async flags and still using builtin_platform_driver_probe().

Hasn't module_platform_driver_probe() the same problem? And there are ~80 drivers which uses that.

Yeah. The biggest problem with all of these is the __init markers. Maybe some familiar with coccinelle can help?

Quoted 7 lines
Quoted 1 line

And dropping them will increase memory usage.

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

Quoted 4 lines

While it's good to drop code that'll not be used past kernel init, the module_platform_driver_probe() is going even more extreme. It doesn't even allow deferred probe (well before kernel init is done). I don't think that behavior is right and that's why we should delete it. Also,

This construct is typically used for builtin hardware for which the dependencies are registered very early, and thus known to probe at first try (if present).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I doubt if any of these probe functions even take up 4KB of memory.

How many 4 KiB pages do you have in a system with 10 MiB of SRAM? How many can you afford to waste?

There are only a few instances of this macro in the kernel. How many

$ git grep -lw builtin_platform_driver_probe | wc -l
21
$ git grep -lw module_platform_driver_probe | wc -l
86
Quoted 5 lines

+ the ones that haven't been converted to the above yet:

$ git grep -lw platform_driver_probe | wc -l
58

Yeah, this adds up in terms of the number of places we'd need to fix. But thinking more about it, a couple of points:
1. Not all builtin_platform_driver_probe() are problems for fw_devlink. So we can just fix them as we go if we need to.

2. The problem with builtin_platform_driver_probe() isn't really with the use of __init. It's the fact that it doesn't allow deferred probes. builtin_platform_driver_probe()/platform_driver_probe() could still be fixed up to allow deferred probe until we get to the point where we free the __init section (so at least till late_initcall).

Quoted 6 lines
Quoted 2 lines

That's intentional: it is used for cases that will (must) never be deferred. That's why it's safe to use __init.

So was the usage of builtin_platform_driver_probe() wrong in the driver Michael fixed? Because, deferring and probing again clearly works?

It wasn't. The regression is that the driver no longer probes at first try, because its dependencies are now probed later. The question is:
why are the dependencies now probed later? How to fix that?

Quoted 5 lines

Also, "must never be deferred" seems like a weird condition to enforce. I think the real "rule" is that if it defers, the platform is not expected to work. But disallowing a probe reattempt seems weird. What is it going to hurt if it's attempted again? At worst it fails one more time?

"must never be deferred" is not the real condition, but "must not be probed after __init is freed" is (one of them, there may be other, cfr. the last paragraph below). The simplest way to guarantee that is to probe the driver immediately, and only once.

Quoted 4 lines

Also, I'd argue that all/most of the "can't defer, but I'm still a proper struct device" cases are all just patchwork to deal with the fact we were playing initcall chicken when there was no fw_devlink. I'm hoping we can move people away from that mindset. And the first

I agree, partially. Still, how come the dependencies are no longer probed before their consumers when fw_devlinks are enabled? I thought fw_devlinks is supposed to avoid exactly that?

Quoted 2 lines

step towards that would be to allow *platform_probe() to allow deferred probes until late_initcall().

At which increase of complexity, to keep track of which drivers can and cannot be reprobed anymore after late_initcall?
Still, many of these drivers use platform_driver_probe() early for a
reason: because they need to initialize the hardware early. Probing them later may introduce subtle bugs.

Gr{oetje,eeting}s,

Geert

Signature · 10 lines
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

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#21 lore raw
Quoted 3 lines · Geert Uytterhoeven

It wasn't. The regression is that the driver no longer probes at first try, because its dependencies are now probed later. The question is:
why are the dependencies now probed later? How to fix that?

I'm afraid that may be unfixable.. It depends on things like the bus driver probe that might get also deferred.

As suggested, I agree it's best to get rid of builtin_platform_driver_probe where possible at the cost of dropping the __init as needed.

To me it seems we can't even add a warning to __platform_driver_probe() if there's drv->driver.of_match_table for example. That warning would show up on all the devices with driver in question built in even if the device has no such hardware.

Regards,

Tony

#22 lore raw
In reply to Michael Walle

Hi,

Quoted 5 lines · Michael Walle

Although I do have the changes for the builtin_platform_driver_probe() ready, I don't think it makes much sense to send these unless we agree on the increased memory footprint. While there are just a few builtin_platform_driver_probe() and memory increase _might_ be negligible, there are many more module_platform_driver_probe().

I just noticed this thread today and have pretty much come to the same conclusions. No need to post a patch for pci-dra7xx.c, I already posted a patch for pci-dra7xx.c yesterday as part of genpd related changes.

For me probing started breaking as the power-domains property got added.

FYI, it's the following patch:

[PATCH 01/15] PCI: pci-dra7xx: Prepare for deferred probe with module_platform_driver

Regards,

Tony

#23 lore raw
In reply to Michael Walle
Quoted 27 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 23 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Quoted 7 lines
Quoted 4 lines

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Can I drop this patch then ?

Thanks,
Lorenzo

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#24 lore raw
Quoted 31 lines · Lorenzo Pieralisi
Quoted 29 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 25 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Can I drop this patch then ?

No, please pick it up. Michael and I were talking about doing similar changes for other drivers.

-Saravana

#25 lore raw

Am 2021-01-25 19:58, schrieb Saravana Kannan:

Quoted 36 lines
Quoted 34 lines · Lorenzo Pieralisi
Quoted 32 lines · Michael Walle

[RESEND, fat-fingered the buttons of my mail client and converted all CCs to BCCs :(]

Am 2021-01-20 20:02, schrieb Saravana Kannan:

Quoted 27 lines · Rob Herring
Quoted 10 lines
Quoted 4 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

If builtin_platform_driver_probe() doesn't work with fw_devlink, then shouldn't it be fixed or removed?

I was actually thinking about this too. The problem with fixing builtin_platform_driver_probe() to behave like builtin_platform_driver() is that these probe functions could be marked with __init. But there are also only 20 instances of builtin_platform_driver_probe() in the kernel:

$ git grep ^builtin_platform_driver_probe | wc -l
20

So it might be easier to just fix them to not use
builtin_platform_driver_probe().

Michael,

Any chance you'd be willing to help me by converting all these to builtin_platform_driver() and delete builtin_platform_driver_probe()?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

If it just moving the probe function to the _driver struct and remove the __init annotations. I could look into that.

Can I drop this patch then ?

No, please pick it up. Michael and I were talking about doing similar changes for other drivers.

Yes please, I was just about to answer, but Saravana beat me.

-michael

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#26 lore raw
In reply to Michael Walle
Quoted 5 lines · Michael Walle

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

Fixes e590474768f1 ("driver core: Set fw_devlink=on by default")

I will have to drop this Fixes: tag if you don't mind, it is not in the mainline.

Lorenzo

Quoted 34 lines
---
 drivers/pci/controller/dwc/pci-layerscape.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-layerscape.c +3 -2
index 44ad34cdc3bc..5b9c625df7b8 100644
@@ -232,7 +232,7 @@ static const struct of_device_id ls_pcie_of_match[] = {
 	{ },
 };
 
-static int __init ls_pcie_probe(struct platform_device *pdev)
+static int ls_pcie_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct dw_pcie *pci;
@@ -271,10 +271,11 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
 }
 
 static struct platform_driver ls_pcie_driver = {
+	.probe = ls_pcie_probe,
 	.driver = {
 		.name = "layerscape-pcie",
 		.of_match_table = ls_pcie_of_match,
 		.suppress_bind_attrs = true,
 	},
 };
-builtin_platform_driver_probe(ls_pcie_driver, ls_pcie_probe);
+builtin_platform_driver(ls_pcie_driver);
Signature · 1 line
2.20.1
#27 lore raw

Am 2021-01-26 11:02, schrieb Lorenzo Pieralisi:

Quoted 9 lines · Michael Walle
Quoted 5 lines

fw_devlink will defer the probe until all suppliers are ready. We can't use builtin_platform_driver_probe() because it doesn't retry after probe deferral. Convert it to builtin_platform_driver().

Fixes e590474768f1 ("driver core: Set fw_devlink=on by default")

I will have to drop this Fixes: tag if you don't mind, it is not in the mainline.

That commit is in Greg's for-next tree:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=driver-core-next&id=e590474768f1cc04852190b61dec692411b22e2a

I was under the impression there are other commits with this particular fixes tag, too. Either it was removed from for-next queues or I was confused.

But I'm fine with removing the tag, assuming this will end up together with the "driver core: Set fw_devlink=on by default" commit in 5.11.

-michael

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#28 lore raw

Hi Michael,

Quoted 16 lines · Michael Walle

Am 2021-01-26 11:02, schrieb Lorenzo Pieralisi:

Quoted 11 lines · Michael Walle
Quoted 7 lines

fw_devlink will defer the probe until all suppliers are ready. We can't
use builtin_platform_driver_probe() because it doesn't retry after probe
deferral. Convert it to builtin_platform_driver().

Fixes e590474768f1 ("driver core: Set fw_devlink=on by default")

I will have to drop this Fixes: tag if you don't mind, it is not in the mainline.

That commit is in Greg's for-next tree:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=driver-core-next&id=e590474768f1cc04852190b61dec692411b22e2a

Quoted 7 lines

I was under the impression there are other commits with this particular fixes tag, too. Either it was removed from for-next queues or I was confused.

But I'm fine with removing the tag, assuming this will end up together with the "driver core: Set fw_devlink=on by default" commit in 5.11.

Definitely not v5.11.

And I sincerely doubt it will be applied for v5.12.
It's already way too late to implement all changes to existing drivers needed, and get them accepted for v5.12.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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