Skip to content

Commit

Permalink
net: sched: Allow statistics reads from softirq.
Browse files Browse the repository at this point in the history
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: 29cbcd8 ("net: sched: Remove Qdisc::running sequence counter")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Sebastian Andrzej Siewior authored and David S. Miller committed Oct 19, 2021
1 parent dc90604 commit e22db7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/gen_stats.c
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit e22db7b

Please sign in to comment.