net_sched: gen_estimator: fix broken estimators based on percpu stats
Subsystems (2)
PATCH 1/1 net_sched: gen_estimator: fix broken estimators based on percpu stats
From: Eric Dumazet <[email protected]>
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.
---
net/core/gen_estimator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
net/core/gen_estimator.c +1 -1
@@ -79,7 +79,7 @@ static void est_fetch_counters(struct net_rate_estimator *e,static void est_timer (struct timer_list *t) {struct net_rate_estimator *est =from_timer (est, t, timer); -struct gnet_stats_basic_packed b; +struct gnet_stats_basic_packed b = {0 };u64 rate, brate;est_fetch_counters (est, &b);
Quoted 22 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
pfifo_fastgot 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 <[email protected]>---
net/core/gen_estimator.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)net/core/gen_estimator.c +0
-0
net/core/gen_estimator.c static void est_fetch_counters(struct net_rate_estimator *e, · line 85
Quoted 8 lines
net/core/gen_estimator.c +1
-1@@ -79,7 +79,7 @@ static void est_fetch_counters(struct net_rate_estimator *e,static void est_timer (struct timer_list *t) {struct net_rate_estimator *est =from_timer (est, t, timer); -struct gnet_stats_basic_packed b; +struct gnet_stats_basic_packed b = {0 };u64 rate, brate;est_fetch_counters (est, &b);
Oh I sent the wrong version of the patch, sorry.
Will send a V2.
PATCH v2 1/1 net_sched: gen_estimator: fix broken estimators based on percpu stats
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
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.
---
v2: Perform the zeroing in est_fetch_counters() instead of caller(s)
net/core/gen_estimator.c | 1 +
1 file changed, 1 insertion(+)
net/core/gen_estimator.c +1 -0
@@ -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);
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Thu, 22 Feb 2018 19:45:27 -0800
Quoted 8 lines
From: Eric Dumazet <[email protected]>
pfifo_fastgot 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.
Quoted 7 lines
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 <[email protected]>---
v2: Perform the zeroing inest_fetch_counters()instead of caller(s)
Applied and queued up for -stable.