From b7397a65cc59914353983cb1a9cf6e48484fded1 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 19 Oct 2021 12:12:04 +0200 Subject: [PATCH 047/158] net: sched: Allow statistics reads from softirq. 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 Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: David S. Miller --- net/core/gen_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-5.15.19-rt29/net/core/gen_stats.c =================================================================== --- linux-5.15.19-rt29.orig/net/core/gen_stats.c +++ linux-5.15.19-rt29/net/core/gen_stats.c @@ -154,7 +154,7 @@ void gnet_stats_add_basic(struct gnet_st 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);