[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1e4e40ba-23b8-65b4-0b53-1c8393d9a834@gmail.com>
Date: Thu, 30 Sep 2021 13:29:33 +0200
From: Rafał Miłecki <zajec5@...il.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Network Development <netdev@...r.kernel.org>,
Florian Fainelli <f.fainelli@...il.com>,
BCM Kernel Feedback <bcm-kernel-feedback-list@...adcom.com>,
Vivek Unune <npcomplete13@...il.com>
Subject: Re: Lockup in phy_probe() for MDIO device (Broadcom's switch)
On 30.09.2021 12:40, Russell King (Oracle) wrote:
> In phy_probe, can you add:
>
> WARN_ON(!(phydev->mdio.flags & MDIO_DEVICE_FLAG_PHY));
>
> just to make sure we have a real PHY device there please? Maybe also
> print the value of the flags argument.
>
> MDIO_DEVICE_FLAG_PHY is set by phy_create_device() before the mutex is
> initialised, so if it is set, the lock should be initialised.
>
> Maybe also print mdiodev->flags in mdio_device_register() as well, so
> we can see what is being registered and the flags being used for that
> device.
>
> Could it be that openwrt is carrying a patch that is causing this
> issue?
I don't think there is any OpenWrt patch affecting that.
MDIO_DEVICE_FLAG_PHY seems to be missing.
[ 5.593833] libphy: Fixed MDIO Bus: probed
[ 5.598383] libphy: iProc MDIO bus: probed
[ 5.602510] iproc-mdio 18003000.mdio: Broadcom iProc MDIO bus registered
[ 5.609918] libphy: mdio_mux: probed
[ 5.613533] mdio_bus 0.0:10: flags: 0x00000000
[ 5.618816] libphy: mdio_mux: probed
[ 5.622440] mdio_bus 0.200:00: flags: 0x00000000
[ 5.627479] Broadcom B53 (2) 0.200:00: flags: 0x00000000
[ 5.632811] ------------[ cut here ]------------
[ 5.637475] WARNING: CPU: 0 PID: 1 at drivers/net/phy/phy_device.c:2828 phy_probe+0x40/0x1d4
[ 5.645946] Modules linked in:
[ 5.649011] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.64 #0
[ 5.655030] Hardware name: BCM5301X
[ 5.658543] [<c0108410>] (unwind_backtrace) from [<c0104bc4>] (show_stack+0x10/0x14)
[ 5.666316] [<c0104bc4>] (show_stack) from [<c03dc6a8>] (dump_stack+0x94/0xa8)
[ 5.673565] [<c03dc6a8>] (dump_stack) from [<c01183e8>] (__warn+0xb8/0x114)
[ 5.680546] [<c01183e8>] (__warn) from [<c01184ac>] (warn_slowpath_fmt+0x68/0x78)
[ 5.688050] [<c01184ac>] (warn_slowpath_fmt) from [<c04b8d78>] (phy_probe+0x40/0x1d4)
[ 5.695909] [<c04b8d78>] (phy_probe) from [<c0457120>] (really_probe+0xfc/0x4e0)
[ 5.703325] [<c0457120>] (really_probe) from [<c0455378>] (bus_for_each_drv+0x74/0x98)
[ 5.711262] [<c0455378>] (bus_for_each_drv) from [<c04576b8>] (__device_attach+0xcc/0x120)
[ 5.719548] [<c04576b8>] (__device_attach) from [<c0456300>] (bus_probe_device+0x84/0x8c)
[ 5.727747] [<c0456300>] (bus_probe_device) from [<c04529ac>] (device_add+0x300/0x77c)
[ 5.735687] [<c04529ac>] (device_add) from [<c04ba3dc>] (mdio_device_register+0x38/0x5c)
[ 5.743801] [<c04ba3dc>] (mdio_device_register) from [<c04c1b08>] (of_mdiobus_register+0x198/0x2fc)
[ 5.752868] [<c04c1b08>] (of_mdiobus_register) from [<c04c238c>] (mdio_mux_init+0x178/0x2c0)
[ 5.761328] [<c04c238c>] (mdio_mux_init) from [<c04c2668>] (mdio_mux_mmioreg_probe+0x138/0x1fc)
[ 5.770054] [<c04c2668>] (mdio_mux_mmioreg_probe) from [<c0458ee4>] (platform_drv_probe+0x34/0x70)
[ 5.779032] [<c0458ee4>] (platform_drv_probe) from [<c0457120>] (really_probe+0xfc/0x4e0)
[ 5.787230] [<c0457120>] (really_probe) from [<c0457b04>] (device_driver_attach+0xe4/0xf4)
[ 5.795516] [<c0457b04>] (device_driver_attach) from [<c0457b90>] (__driver_attach+0x7c/0x110)
[ 5.804149] [<c0457b90>] (__driver_attach) from [<c04552d8>] (bus_for_each_dev+0x64/0x90)
[ 5.812340] [<c04552d8>] (bus_for_each_dev) from [<c04564f8>] (bus_add_driver+0xf8/0x1e0)
[ 5.820540] [<c04564f8>] (bus_add_driver) from [<c045819c>] (driver_register+0x88/0x118)
[ 5.828652] [<c045819c>] (driver_register) from [<c01017e4>] (do_one_initcall+0x54/0x1e8)
[ 5.836863] [<c01017e4>] (do_one_initcall) from [<c0801118>] (kernel_init_freeable+0x23c/0x290)
[ 5.845583] [<c0801118>] (kernel_init_freeable) from [<c065ad40>] (kernel_init+0x8/0x118)
[ 5.853781] [<c065ad40>] (kernel_init) from [<c0100128>] (ret_from_fork+0x14/0x2c)
[ 5.861367] Exception stack(0xc1035fb0 to 0xc1035ff8)
[ 5.866425] 5fa0: 00000000 00000000 00000000 00000000
[ 5.874618] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 5.882816] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 5.889473] ---[ end trace f28513567c7daf95 ]---
[ 5.894105] ------------[ cut here ]------------
[ 5.898743] WARNING: CPU: 0 PID: 1 at kernel/locking/mutex.c:951 __mutex_lock.constprop.0+0x744/0x848
[ 5.907983] DEBUG_LOCKS_WARN_ON(lock->magic != lock)
diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c
index 0837319a5..910149c8d 100644
--- a/drivers/net/phy/mdio_device.c
+++ b/drivers/net/phy/mdio_device.c
@@ -83,6 +83,8 @@ int mdio_device_register(struct mdio_device *mdiodev)
if (err)
return err;
+ dev_info(&mdiodev->dev, "flags: 0x%08x\n", mdiodev->flags);
+
err = device_add(&mdiodev->dev);
if (err) {
pr_err("MDIO %d failed to add\n", mdiodev->addr);
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 950277e4d..02c06e6d5 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2824,6 +2824,9 @@ static int phy_probe(struct device *dev)
struct phy_driver *phydrv = to_phy_driver(drv);
int err = 0;
+ dev_info(dev, "flags: 0x%08x\n", phydev->mdio.flags);
+ WARN_ON(!(phydev->mdio.flags & MDIO_DEVICE_FLAG_PHY));
+
phydev->drv = phydrv;
/* Disable the interrupt if the PHY doesn't support it
Powered by blists - more mailing lists