This patch series was started due to -EPROBE_DEFER not being handled
correctly in mdio_mux_init() and causing issues [1]. While at it, I also
did some more error handling fixes and clean ups. The -EPROBE_DEFER fix is
the last patch.
Ideally, in the last patch we'd treat any error similar to -EPROBE_DEFER
but I'm not sure if it'll break any board/platforms where some child
mdiobus never successfully registers. If we treated all errors similar to
-EPROBE_DEFER, then none of the child mdiobus will work and that might be a
regression. If people are sure this is not a real case, then I can fix up
the last patch to always fail the entire mdio-mux init if any of the child
mdiobus registration fails.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Neil Armstrong <redacted>
Cc: Kevin Hilman <khilman@baylibre.com>
[1] - https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t
Saravana Kannan (3):
net: mdio-mux: Delete unnecessary devm_kfree
net: mdio-mux: Don't ignore memory allocation errors
net: mdio-mux: Handle -EPROBE_DEFER correctly
drivers/net/mdio/mdio-mux.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
--
2.32.0.554.ge1b32706d8-goog
The whole point of devm_* APIs is that you don't have to undo them if you
are returning an error that's going to get propagated out of a probe()
function. So delete unnecessary devm_kfree() call in the error return path.
Signed-off-by: Saravana Kannan <redacted>
---
drivers/net/mdio/mdio-mux.c | 1 -
1 file changed, 1 deletion(-)
When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't
ignore it and continue registering the rest of the mdiobus children. This
would permanently prevent the deferring child mdiobus from working instead
of reattempting it in the future. So, if a child mdiobus needs to be
reattempted in the future, defer the entire mdio-mux initialization.
This fixes the issue where PHYs sitting under the mdio-mux aren't
initialized correctly if the PHY's interrupt controller is not yet ready
when the mdio-mux is being probed. Additional context in the link below.
Link: https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t
Signed-off-by: Saravana Kannan <redacted>
---
drivers/net/mdio/mdio-mux.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
@@ -175,11 +175,15 @@ int mdio_mux_init(struct device *dev,cb->mii_bus->write=mdio_mux_write;r=of_mdiobus_register(cb->mii_bus,child_bus_node);if(r){+mdiobus_free(cb->mii_bus);+if(r==-EPROBE_DEFER){+ret_val=r;+gotoerr_loop;+}+devm_kfree(dev,cb);dev_err(dev,"Error: Failed to register MDIO bus for child %pOF\n",child_bus_node);-mdiobus_free(cb->mii_bus);-devm_kfree(dev,cb);}else{cb->next=pb->children;pb->children=cb;
From: Marc Zyngier <maz@kernel.org> Date: 2021-08-05 09:02:47
Hi Saravana,
On Wed, 04 Aug 2021 22:43:29 +0100,
Saravana Kannan [off-list ref] wrote:
This patch series was started due to -EPROBE_DEFER not being handled
correctly in mdio_mux_init() and causing issues [1]. While at it, I also
did some more error handling fixes and clean ups. The -EPROBE_DEFER fix is
the last patch.
Ideally, in the last patch we'd treat any error similar to -EPROBE_DEFER
but I'm not sure if it'll break any board/platforms where some child
mdiobus never successfully registers. If we treated all errors similar to
-EPROBE_DEFER, then none of the child mdiobus will work and that might be a
regression. If people are sure this is not a real case, then I can fix up
the last patch to always fail the entire mdio-mux init if any of the child
mdiobus registration fails.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Neil Armstrong <redacted>
Cc: Kevin Hilman <khilman@baylibre.com>
[1] - https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t
Saravana Kannan (3):
net: mdio-mux: Delete unnecessary devm_kfree
net: mdio-mux: Don't ignore memory allocation errors
net: mdio-mux: Handle -EPROBE_DEFER correctly
drivers/net/mdio/mdio-mux.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
Thanks for this. I've just gave it a go on my test platform, and this
indeed addresses the issues I was seeing [1].
Acked-by: Marc Zyngier <maz@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
M.
[1] https://lore.kernel.org/r/87im0m277h.wl-maz@kernel.org
--
Without deviation from the norm, progress is not possible.
From: Kevin Hilman <khilman@baylibre.com> Date: 2021-08-05 18:36:41
Marc Zyngier [off-list ref] writes:
Hi Saravana,
On Wed, 04 Aug 2021 22:43:29 +0100,
Saravana Kannan [off-list ref] wrote:
quoted
This patch series was started due to -EPROBE_DEFER not being handled
correctly in mdio_mux_init() and causing issues [1]. While at it, I also
did some more error handling fixes and clean ups. The -EPROBE_DEFER fix is
the last patch.
Ideally, in the last patch we'd treat any error similar to -EPROBE_DEFER
but I'm not sure if it'll break any board/platforms where some child
mdiobus never successfully registers. If we treated all errors similar to
-EPROBE_DEFER, then none of the child mdiobus will work and that might be a
regression. If people are sure this is not a real case, then I can fix up
the last patch to always fail the entire mdio-mux init if any of the child
mdiobus registration fails.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Neil Armstrong <redacted>
Cc: Kevin Hilman <khilman@baylibre.com>
[1] - https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t
Saravana Kannan (3):
net: mdio-mux: Delete unnecessary devm_kfree
net: mdio-mux: Don't ignore memory allocation errors
net: mdio-mux: Handle -EPROBE_DEFER correctly
drivers/net/mdio/mdio-mux.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
Thanks for this. I've just gave it a go on my test platform, and this
indeed addresses the issues I was seeing [1].
Acked-by: Marc Zyngier <maz@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
I wasn't seeing the same issues as Marc, but am heavily using everything
as modules on a few platforms using this code, and I'm not seeing any
regressions.
Thanks Saravana for finding the root cause here.
Acked-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Kevin
From: Kevin Hilman <khilman@baylibre.com> Date: 2021-08-05 18:38:15
On Thu, Aug 5, 2021 at 11:36 AM Kevin Hilman [off-list ref] wrote:
Marc Zyngier [off-list ref] writes:
quoted
Hi Saravana,
On Wed, 04 Aug 2021 22:43:29 +0100,
Saravana Kannan [off-list ref] wrote:
quoted
This patch series was started due to -EPROBE_DEFER not being handled
correctly in mdio_mux_init() and causing issues [1]. While at it, I also
did some more error handling fixes and clean ups. The -EPROBE_DEFER fix is
the last patch.
Ideally, in the last patch we'd treat any error similar to -EPROBE_DEFER
but I'm not sure if it'll break any board/platforms where some child
mdiobus never successfully registers. If we treated all errors similar to
-EPROBE_DEFER, then none of the child mdiobus will work and that might be a
regression. If people are sure this is not a real case, then I can fix up
the last patch to always fail the entire mdio-mux init if any of the child
mdiobus registration fails.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Neil Armstrong <redacted>
Cc: Kevin Hilman <khilman@baylibre.com>
[1] - https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t
Saravana Kannan (3):
net: mdio-mux: Delete unnecessary devm_kfree
net: mdio-mux: Don't ignore memory allocation errors
net: mdio-mux: Handle -EPROBE_DEFER correctly
drivers/net/mdio/mdio-mux.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
Thanks for this. I've just gave it a go on my test platform, and this
indeed addresses the issues I was seeing [1].
Acked-by: Marc Zyngier <maz@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
I wasn't seeing the same issues as Marc, but am heavily using everything
as modules on a few platforms using this code, and I'm not seeing any
regressions.
Thanks Saravana for finding the root cause here.
Acked-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Oops, that should not be a SoB, but rather:
Tested-by: Kevin Hilman <khilman@baylibre.com>
On Thu, Aug 5, 2021 at 11:38 AM Kevin Hilman [off-list ref] wrote:
On Thu, Aug 5, 2021 at 11:36 AM Kevin Hilman [off-list ref] wrote:
quoted
Marc Zyngier [off-list ref] writes:
quoted
Hi Saravana,
On Wed, 04 Aug 2021 22:43:29 +0100,
Saravana Kannan [off-list ref] wrote:
quoted
This patch series was started due to -EPROBE_DEFER not being handled
correctly in mdio_mux_init() and causing issues [1]. While at it, I also
did some more error handling fixes and clean ups. The -EPROBE_DEFER fix is
the last patch.
Ideally, in the last patch we'd treat any error similar to -EPROBE_DEFER
but I'm not sure if it'll break any board/platforms where some child
mdiobus never successfully registers. If we treated all errors similar to
-EPROBE_DEFER, then none of the child mdiobus will work and that might be a
regression. If people are sure this is not a real case, then I can fix up
the last patch to always fail the entire mdio-mux init if any of the child
mdiobus registration fails.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Neil Armstrong <redacted>
Cc: Kevin Hilman <khilman@baylibre.com>
[1] - https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t
Saravana Kannan (3):
net: mdio-mux: Delete unnecessary devm_kfree
net: mdio-mux: Don't ignore memory allocation errors
net: mdio-mux: Handle -EPROBE_DEFER correctly
drivers/net/mdio/mdio-mux.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
Thanks for this. I've just gave it a go on my test platform, and this
indeed addresses the issues I was seeing [1].
Acked-by: Marc Zyngier <maz@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
I wasn't seeing the same issues as Marc, but am heavily using everything
as modules on a few platforms using this code, and I'm not seeing any
regressions.
The only guess I have for this difference in results is I'm guessing
in your case the IRQ module is somehow getting loaded before the
mux/PHY driver?
quoted
Thanks Saravana for finding the root cause here.
Acked-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Oops, that should not be a SoB, but rather:
Tested-by: Kevin Hilman <khilman@baylibre.com>
From: Andrew Lunn <andrew@lunn.ch> Date: 2021-08-07 14:23:28
On Wed, Aug 04, 2021 at 02:43:30PM -0700, Saravana Kannan wrote:
The whole point of devm_* APIs is that you don't have to undo them if you
are returning an error that's going to get propagated out of a probe()
function. So delete unnecessary devm_kfree() call in the error return path.
Signed-off-by: Saravana Kannan <redacted>
From: Andrew Lunn <andrew@lunn.ch> Date: 2021-08-07 15:49:45
On Wed, Aug 04, 2021 at 02:43:32PM -0700, Saravana Kannan wrote:
When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't
ignore it and continue registering the rest of the mdiobus children. This
would permanently prevent the deferring child mdiobus from working instead
of reattempting it in the future. So, if a child mdiobus needs to be
reattempted in the future, defer the entire mdio-mux initialization.
This fixes the issue where PHYs sitting under the mdio-mux aren't
initialized correctly if the PHY's interrupt controller is not yet ready
when the mdio-mux is being probed. Additional context in the link below.
Link: https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t
Signed-off-by: Saravana Kannan <redacted>