Skip to content

net: phy: Fix race condition on link status change

During testing of low-power modes, it was discovered that after the board resume the following error occurs:

[  130.897170] fec 2188000.ethernet eth0: Link is Down
[  130.927498] fec 2188000.ethernet eth0: MDIO read timeout
[  130.927633] ------------[ cut here ]------------
[  130.927649] WARNING: CPU: 1 PID: 1423 at drivers/net/phy/phy.c:942 phy_error+0x20/0x68
[  130.927684] Modules linked in: snd_soc_simple_amplifier snd_soc_sgtl5000 imx_sdma coda_vpu v4l2_jpeg imx_vdoa videobuf2_vmalloc dw_hdmi_ahb_audio snd_soc_simple_card sis_i2c(O) scx0500633(O) rtc_pcf8563_guf(O)
 ni_force_ts(O) imx6_spreadspectrum(O) ilitek(O) ili2118(O) gfplatdetect(O) egalaxi2c(O) eetii2c(O) atmel_mxt(O) kernel_module_touchgpio(O) configfs
[  130.927947] CPU: 1 PID: 1423 Comm: irq/110-2188000 Tainted: G           O      5.15.29-guf #1
[  130.927966] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[  130.927981] [<c01116e8>] (unwind_backtrace) from [<c010bad4>] (show_stack+0x10/0x14)
[  130.928013] [<c010bad4>] (show_stack) from [<c0e22ad8>] (dump_stack_lvl+0x58/0x70)
[  130.928044] [<c0e22ad8>] (dump_stack_lvl) from [<c012b010>] (__warn+0xd4/0x154)
[  130.928069] [<c012b010>] (__warn) from [<c0e1d0b0>] (warn_slowpath_fmt+0x74/0xa8)
[  130.928090] [<c0e1d0b0>] (warn_slowpath_fmt) from [<c08b0778>] (phy_error+0x20/0x68)
[  130.928112] [<c08b0778>] (phy_error) from [<c08bc208>] (smsc_phy_handle_interrupt+0x58/0x60)
[  130.928137] [<c08bc208>] (smsc_phy_handle_interrupt) from [<c01a2afc>] (irq_thread_fn+0x1c/0x78)
[  130.928165] [<c01a2afc>] (irq_thread_fn) from [<c01a2d64>] (irq_thread+0x154/0x294)
[  130.928187] [<c01a2d64>] (irq_thread) from [<c015700c>] (kthread+0x144/0x168)
[  130.928210] [<c015700c>] (kthread) from [<c010011c>] (ret_from_fork+0x14/0x38)
[  130.928229] Exception stack(0xc80c7fb0 to 0xc80c7ff8)
[  130.928244] 7fa0:                                     00000000 00000000 00000000 00000000
[  130.928258] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  130.928271] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[  130.928282] irq event stamp: 13889
[  130.928294] hardirqs last  enabled at (13897): [<c019ed54>] vprintk_emit+0x2dc/0x310
[  130.928299] PM: suspend devices took 0.640 seconds
[  130.928315] hardirqs last disabled at (13904): [<c019ed00>] vprintk_emit+0x288/0x310
[  130.928332] softirqs last  enabled at (3478): [<c01015a0>] __do_softirq+0x300/0x5b8
[  130.928351] softirqs last disabled at (3467): [<c01338e8>] __irq_exit_rcu+0x160/0x1d8
[  130.928374] ---[ end trace bc64ac1f231063ed ]---

There is a patch solved the problem in upstream: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/net/phy/phy.c?h=linux-5.15.y&id=1bd91049e3789ea71bccc4f9187dd4b949398557

Cherry-pick it to linux-5.15.29-guf branch.

Edited by Dmitry Petrov

Merge request reports

Loading