diff mbox series

[v2,net] net_sched: gen_estimator: fix broken estimators based on percpu stats

Message ID 1519357527.55655.66.camel@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series [v2,net] net_sched: gen_estimator: fix broken estimators based on percpu stats | expand

Commit Message

Eric Dumazet Feb. 23, 2018, 3:45 a.m. UTC
From: Eric Dumazet <edumazet@google.com>

pfifo_fast got percpu stats lately, uncovering a bug I introduced last
year in linux-4.10.

I missed the fact that we have to clear our temporary storage
before calling __gnet_stats_copy_basic() in the case of percpu stats.

Without this fix, rate estimators (tc qd replace dev xxx root est 1sec
4sec pfifo_fast) are utterly broken.

Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
v2: Perform the zeroing in est_fetch_counters() instead of caller(s)

 net/core/gen_estimator.c |    1 +
 1 file changed, 1 insertion(+)

Comments

David Miller Feb. 23, 2018, 5:43 p.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 22 Feb 2018 19:45:27 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> pfifo_fast got percpu stats lately, uncovering a bug I introduced last
> year in linux-4.10.
> 
> I missed the fact that we have to clear our temporary storage
> before calling __gnet_stats_copy_basic() in the case of percpu stats.
> 
> Without this fix, rate estimators (tc qd replace dev xxx root est 1sec
> 4sec pfifo_fast) are utterly broken.
> 
> Fixes: 1c0d32fde5bd ("net_sched: gen_estimator: complete rewrite of rate estimators")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> v2: Perform the zeroing in est_fetch_counters() instead of caller(s)

Applied and queued up for -stable.
diff mbox series

Patch

diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 0a3f88f08727f1f1217560407ff539c8a8c17496..98fd12721221e4aa26e4d11be9de6c0305fb6dd9 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -66,6 +66,7 @@  struct net_rate_estimator {
 static void est_fetch_counters(struct net_rate_estimator *e,
 			       struct gnet_stats_basic_packed *b)
 {
+	memset(b, 0, sizeof(*b));
 	if (e->stats_lock)
 		spin_lock(e->stats_lock);