mbox series

[v1,0/3] Clean up and fix error handling in mdio_mux_init()

Message ID 20210804214333.927985-1-saravanak@google.com (mailing list archive)
Headers show
Series Clean up and fix error handling in mdio_mux_init() | expand

Message

Saravana Kannan Aug. 4, 2021, 9:43 p.m. UTC
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 <narmstrong@baylibre.com>
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(-)

Comments

Marc Zyngier Aug. 5, 2021, 9:02 a.m. UTC | #1
Hi Saravana,

On Wed, 04 Aug 2021 22:43:29 +0100,
Saravana Kannan <saravanak@google.com> 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 <narmstrong@baylibre.com>
> 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
David Miller Aug. 5, 2021, 10:31 a.m. UTC | #2
Please resubmit the cleanups targetting net-next and the bug fix targetting net.

Thank you.
Kevin Hilman Aug. 5, 2021, 6:36 p.m. UTC | #3
Marc Zyngier <maz@kernel.org> writes:

> Hi Saravana,
>
> On Wed, 04 Aug 2021 22:43:29 +0100,
> Saravana Kannan <saravanak@google.com> 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 <narmstrong@baylibre.com>
>> 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
Kevin Hilman Aug. 5, 2021, 6:37 p.m. UTC | #4
On Thu, Aug 5, 2021 at 11:36 AM Kevin Hilman <khilman@baylibre.com> wrote:
>
> Marc Zyngier <maz@kernel.org> writes:
>
> > Hi Saravana,
> >
> > On Wed, 04 Aug 2021 22:43:29 +0100,
> > Saravana Kannan <saravanak@google.com> 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 <narmstrong@baylibre.com>
> >> 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>
Saravana Kannan Aug. 5, 2021, 6:47 p.m. UTC | #5
On Thu, Aug 5, 2021 at 11:38 AM Kevin Hilman <khilman@baylibre.com> wrote:
>
> On Thu, Aug 5, 2021 at 11:36 AM Kevin Hilman <khilman@baylibre.com> wrote:
> >
> > Marc Zyngier <maz@kernel.org> writes:
> >
> > > Hi Saravana,
> > >
> > > On Wed, 04 Aug 2021 22:43:29 +0100,
> > > Saravana Kannan <saravanak@google.com> 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 <narmstrong@baylibre.com>
> > >> 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?

> >
> > 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>

Thanks for the Acks/tests.

-Saravana