From patchwork Fri Feb 23 03:36:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 876960 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="F7qA9tT3"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zncMk1p77z9rxx for ; Fri, 23 Feb 2018 14:36:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbeBWDgS (ORCPT ); Thu, 22 Feb 2018 22:36:18 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35448 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751296AbeBWDgR (ORCPT ); Thu, 22 Feb 2018 22:36:17 -0500 Received: by mail-pg0-f68.google.com with SMTP id l131so2866087pga.2 for ; Thu, 22 Feb 2018 19:36:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=SkXThN/fG17DV9nsiGSJ/6k1JwB5OduUb0O2qRtvimo=; b=F7qA9tT3mqDUL448elH1fSCJT+cH05E4D02qAcwWUhfISI+nt1WRfAhg1+eQOybwLD yzIaAodTQ6ZdOcUQIR0hI6LJn8astd49jRFg/XbCwD2uygeCvRGuMwdhFaHeTPEYrBZV SZWjdbEzBGfBjzi0DNOQd93Xy/V+ZMxVygXZwNuWlvchxIHKWkSpEi71FaLEVFBx9wnj l5DY3hWT63x8YST9GJn4X7Z3O3zzZGj/zfvBDjOZmhaHuIZCkt+jGizIFTx6fnUUzrEn 9xc81/YhsQws0olRztqTB4injWvEa6TVP2QFKgIulkihTUmKPoRqIcDK5fvcyGAOwQ+G 1QGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=SkXThN/fG17DV9nsiGSJ/6k1JwB5OduUb0O2qRtvimo=; b=PD1ym9lCHAq6mEZPqe5+bKmEuRIkdX6y6d9crmHEOQm7BzOFBEhn/7HEba2V9BGyCs voJEdmwLjoKnh3/xZPVX1CCcRI6SX6oypjhlbaLO+zRNB1fdGJcAHcKR1a5LuudDWwsG 92omc73PAiXmIsWkPaX2MezSIf+AcwcbXny+yWJ+rhmPFJ+h197YU9MbtaO81EDxvXUD 9UAT1RrJ/ZkaPFzEsCcCROWhkPKoCjM5UoUS8yfG9tt9BIZb0neDX/jOWVmF+/m3sFXU D7c7TNUmz6SV3ryxGtMZzLj9VDeQReU/V67rPEUxpYtJ/CG0wwnsxraevttJiZVr90Bu XdHA== X-Gm-Message-State: APf1xPDTKIxTfJmuF9ZVgY78pBF2G0lRFJSOKz0AfMtxU+FFDtwjF2fg ThxpUDm9ieRhhN05n+A1xXHiJw== X-Google-Smtp-Source: AH8x226pJiWzPxgJKcho0j7oTBreEiuP2jyivmkPbvz2565C7mkGQZaNQzLbDJFWtUn6fQ86LL+bVg== X-Received: by 10.101.101.5 with SMTP id x5mr7771pgv.195.1519356977185; Thu, 22 Feb 2018 19:36:17 -0800 (PST) Received: from edumazet-glaptop3.lan (c-67-180-167-114.hsd1.ca.comcast.net. [67.180.167.114]) by smtp.googlemail.com with ESMTPSA id a67sm1035263pgc.6.2018.02.22.19.36.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Feb 2018 19:36:15 -0800 (PST) Message-ID: <1519356974.55655.63.camel@gmail.com> Subject: [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:36:14 -0800 X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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);