On MDIO-connected MT753x switches .get_stats64 reads the MIB counters
under the MDIO bus mutex although it runs in atomic context, so reading
/proc/net/dev reports "sleeping function called from invalid context".
With CONFIG_DEBUG_ATOMIC_SLEEP=y the sleep inside the RCU read section
can lock up a CPU. The upstream fix polls the counters from a delayed
work and returns cached values. It is in mainline from v7.1-rc3 and not
in 6.18.y.
Tested on a Keenetic KN-1012 (MT7981B, MT7531) with
CONFIG_DEBUG_ATOMIC_SLEEP=y: a loop reading /proc/net/dev locked up a
CPU within a minute without the fix, and ran 41 minutes clean with it
while the counters kept advancing.
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Link: https://github.com/openwrt/openwrt/pull/25383
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>