diff mbox series

[net-next] net: sched: Allow statistics reads from softirq.

Message ID 20211019101204.4a7m2i3u5uoqrc6b@linutronix.de (mailing list archive)
State Accepted
Commit e22db7bd552f7f7f19fe4ef60abfb7e7b364e3a8
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: sched: Allow statistics reads from softirq. | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 7 this patch: 7
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Fixes tag looks correct
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Sebastian Andrzej Siewior Oct. 19, 2021, 10:12 a.m. UTC
Eric reported that the rate estimator reads statics from the softirq
which in turn triggers a warning introduced in the statistics rework.

The warning is too cautious. The updates happen in the softirq context
so reads from softirq are fine since the writes can not be preempted.
The updates/writes happen during qdisc_run() which ensures one writer
and the softirq context.
The remaining bad context for reading statistics remains in hard-IRQ
because it may preempt a writer.

Fixes: 29cbcd8582837 ("net: sched: Remove Qdisc::running sequence counter")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 net/core/gen_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 19, 2021, 12:10 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Tue, 19 Oct 2021 12:12:04 +0200 you wrote:
> Eric reported that the rate estimator reads statics from the softirq
> which in turn triggers a warning introduced in the statistics rework.
> 
> The warning is too cautious. The updates happen in the softirq context
> so reads from softirq are fine since the writes can not be preempted.
> The updates/writes happen during qdisc_run() which ensures one writer
> and the softirq context.
> The remaining bad context for reading statistics remains in hard-IRQ
> because it may preempt a writer.
> 
> [...]

Here is the summary with links:
  - [net-next] net: sched: Allow statistics reads from softirq.
    https://git.kernel.org/netdev/net-next/c/e22db7bd552f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index 5516ea0d5da0b..15c270e22c5ef 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -154,7 +154,7 @@  void gnet_stats_add_basic(struct gnet_stats_basic_sync *bstats,
 	u64 bytes = 0;
 	u64 packets = 0;
 
-	WARN_ON_ONCE((cpu || running) && !in_task());
+	WARN_ON_ONCE((cpu || running) && in_hardirq());
 
 	if (cpu) {
 		gnet_stats_add_basic_cpu(bstats, cpu);