From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f193.google.com ([209.85.192.193]:46514 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750995AbeBWDk0 (ORCPT ); Thu, 22 Feb 2018 22:40:26 -0500 Received: by mail-pf0-f193.google.com with SMTP id z24so2983349pfh.13 for ; Thu, 22 Feb 2018 19:40:26 -0800 (PST) Message-ID: <1519357224.55655.64.camel@gmail.com> Subject: Re: [PATCH net] net_sched: gen_estimator: fix broken estimators based on percpu stats From: Eric Dumazet To: David Miller Cc: netdev , John Fastabend , Cong Wang , Jamal Hadi Salim , Jiri Pirko Date: Thu, 22 Feb 2018 19:40:24 -0800 In-Reply-To: <1519356974.55655.63.camel@gmail.com> References: <1519356974.55655.63.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org List-ID: On Thu, 2018-02-22 at 19:36 -0800, Eric Dumazet wrote: > From: Eric Dumazet > > 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 > --- >  net/core/gen_estimator.c |    2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c > index 0a3f88f08727f1f1217560407ff539c8a8c17496..f13ea3c1fa3eddc6be172df9eda8828da76045e7 100644 > --- a/net/core/gen_estimator.c > +++ b/net/core/gen_estimator.c > @@ -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.