Skip to contentSkip to conversation

rtase: Avoid sleeping in get_stats64()

PATCH Applied Justin Lai 2 participants 2 messages Jun 3 – Jun 4

Subsystems (4)
lore
Share & tools
lore

Justin Lai

author maintainer
#0 lore raw

PATCH v2 1/1 rtase: Avoid sleeping in get_stats64()

The .ndo_get_stats64 callback must not sleep because it can be called when reading /proc/net/dev.

rtase_get_stats64() calls rtase_dump_tally_counter(), which polls the tally counter dump bit with read_poll_timeout(). This may sleep while waiting for the hardware counter dump to complete.

Use read_poll_timeout_atomic() instead to avoid sleeping in the get_stats64() path.

Fixes 079600489960 ("rtase: Implement net_device_ops")

---
v1 -> v2:
- Target net tree.
- Add Fixes tag.
- Add Cc: [email protected].

---
 drivers/net/ethernet/realtek/rtase/rtase_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/rtase/rtase_main.c +3 -2
index 6ccbefb5acf2..55105d34bc79 100644
@@ -1565,8 +1565,9 @@ static void rtase_dump_tally_counter(const struct rtase_private *tp)
 	rtase_w32(tp, RTASE_DTCCR0, cmd);
 	rtase_w32(tp, RTASE_DTCCR0, cmd | RTASE_COUNTER_DUMP);
 
-	err = read_poll_timeout(rtase_r32, val, !(val & RTASE_COUNTER_DUMP),
-				10, 250, false, tp, RTASE_DTCCR0);
+	err = read_poll_timeout_atomic(rtase_r32, val,
+				       !(val & RTASE_COUNTER_DUMP),
+				       10, 250, false, tp, RTASE_DTCCR0);
 
 	if (err == -ETIMEDOUT)
 		netdev_err(tp->dev, "error occurred in dump tally counter\n");
Signature · 1 line
2.40.1
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 3 Jun 2026 14:18:16 +0800 you wrote:

The .ndo_get_stats64 callback must not sleep because it can be called when reading /proc/net/dev.

rtase_get_stats64() calls rtase_dump_tally_counter(), which polls the tally counter dump bit with read_poll_timeout(). This may sleep while waiting for the hardware counter dump to complete.

[...]

Here is the summary with links:
- [net,v2] rtase: Avoid sleeping in get_stats64()

    https://git.kernel.org/netdev/net/c/9fc237f8d49f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html