Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp736722ybl; Wed, 4 Dec 2019 10:02:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwh+BNtyoAgi5w5ECXhUvVqFEEO4RxO+Qh52V+HmjEPKCLll4LhJ9eOI97Tfxpc9321iQId X-Received: by 2002:a9d:708f:: with SMTP id l15mr3658201otj.286.1575482550197; Wed, 04 Dec 2019 10:02:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575482550; cv=none; d=google.com; s=arc-20160816; b=M2s0fRq+7SOwtIS+IdFI5SyYO2wX3pEwX4EGg8UKeg98YJinvGzEup7roWAbslFaQK cG6T2w7rYj3IiqFdiOHQlBLz+4rf050QfGDJcJSC4gg8a20BfpMN58zrxGK3pV3FXK2j yt6TVQjebbPiTgT+yK3urSJtV1Vte8dHJvnkMupQ+zvAKTdXczNP2/u7hI6SfADCNGYf Kgx1rpMZqdWFiMFiQ9HqTs85hwUXXRaRb8VT0GekBCnGzWhRVgpm7OtZp2+v/hX9Z5PY mjJ5SkHc0QrpeYYbOL4fiT0oq8EPwiUqyh8yAKFrKuTT4ZwOnmx5URiRabGyNUmjjVeq StRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hUEZnxweFWSXzs1/19vIxmMk0sNRq6oEq8S1I3eECpI=; b=kOst8Qjkg12LILFoMI848u+tfRt2wJ+Z0Xe9J43H/33wNQJmymLJj2e70Fn5kDFNGJ bTfUdAZab/WDQda9mHi5YiWOAGBkQ4pQRbiauueSCwi0TNsaMTCVRBUXIK/Opb9eSkms XeruuM7pZND8wmtwzLGfMR36J2Rlw/VG4FPasjxxGqgwOpVVS0UiUgXp8KHQja9usnRM upYczXbt/qLZmWn5xMXXVxF8h9FFwMhZJMi9Ogxxu8QINNPpuxU8UEWZETGwW8g3i4pd NQGfbPL7gEc7XKanTGrvfpvoya1SdQKAKwlXoA2ZgVAE6tPi1g9g0rNMM+99AhYQFiN2 jehQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F2OC8i5b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si3295799otp.124.2019.12.04.10.02.16; Wed, 04 Dec 2019 10:02:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F2OC8i5b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729471AbfLDSBA (ORCPT + 99 others); Wed, 4 Dec 2019 13:01:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:40534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729459AbfLDSA6 (ORCPT ); Wed, 4 Dec 2019 13:00:58 -0500 Received: from localhost (unknown [217.68.49.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 42D7B20659; Wed, 4 Dec 2019 18:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482457; bh=qwhmJel4Tb9FEkQb9Oal0KryGLoWB97vNL8j3CVZKys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2OC8i5b99EWyfJyODxjBnLDkYeZ0kM+BzOzIgFlNrarZlzWsLG4Km1xRRbcM0xX0 jnBw+3oqNZeoXVqEpTEOz3xLmpHLHpaBnHZjuKq6zKAbx8fIjQk6cSdEbvp3spYYjf DB8/VFNakdS5SQ1cthM4LEyzALEYCE7ENRMnTVco= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dust Li , Tony Lu , Cong Wang , "David S. Miller" Subject: [PATCH 4.4 89/92] net: sched: fix `tc -s class show` no bstats on class with nolock subqueues Date: Wed, 4 Dec 2019 18:50:29 +0100 Message-Id: <20191204174335.511244512@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204174327.215426506@linuxfoundation.org> References: <20191204174327.215426506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dust Li [ Upstream commit 14e54ab9143fa60794d13ea0a66c792a2046a8f3 ] When a classful qdisc's child qdisc has set the flag TCQ_F_CPUSTATS (pfifo_fast for example), the child qdisc's cpu_bstats should be passed to gnet_stats_copy_basic(), but many classful qdisc didn't do that. As a result, `tc -s class show dev DEV` always return 0 for bytes and packets in this case. Pass the child qdisc's cpu_bstats to gnet_stats_copy_basic() to fix this issue. The qstats also has this problem, but it has been fixed in 5dd431b6b9 ("net: sched: introduce and use qstats read...") and bstats still remains buggy. Fixes: 22e0f8b9322c ("net: sched: make bstats per cpu and estimator RCU safe") Signed-off-by: Dust Li Signed-off-by: Tony Lu Acked-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_mq.c | 2 +- net/sched/sch_mqprio.c | 3 ++- net/sched/sch_multiq.c | 2 +- net/sched/sch_prio.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) --- a/net/sched/sch_mq.c +++ b/net/sched/sch_mq.c @@ -195,7 +195,7 @@ static int mq_dump_class_stats(struct Qd struct netdev_queue *dev_queue = mq_queue_get(sch, cl); sch = dev_queue->qdisc_sleeping; - if (gnet_stats_copy_basic(d, NULL, &sch->bstats) < 0 || + if (gnet_stats_copy_basic(d, sch->cpu_bstats, &sch->bstats) < 0 || gnet_stats_copy_queue(d, NULL, &sch->qstats, sch->q.qlen) < 0) return -1; return 0; --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -355,7 +355,8 @@ static int mqprio_dump_class_stats(struc struct netdev_queue *dev_queue = mqprio_queue_get(sch, cl); sch = dev_queue->qdisc_sleeping; - if (gnet_stats_copy_basic(d, NULL, &sch->bstats) < 0 || + if (gnet_stats_copy_basic(d, sch->cpu_bstats, + &sch->bstats) < 0 || gnet_stats_copy_queue(d, NULL, &sch->qstats, sch->q.qlen) < 0) return -1; --- a/net/sched/sch_multiq.c +++ b/net/sched/sch_multiq.c @@ -351,7 +351,7 @@ static int multiq_dump_class_stats(struc struct Qdisc *cl_q; cl_q = q->queues[cl - 1]; - if (gnet_stats_copy_basic(d, NULL, &cl_q->bstats) < 0 || + if (gnet_stats_copy_basic(d, cl_q->cpu_bstats, &cl_q->bstats) < 0 || gnet_stats_copy_queue(d, NULL, &cl_q->qstats, cl_q->q.qlen) < 0) return -1; --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c @@ -319,7 +319,7 @@ static int prio_dump_class_stats(struct struct Qdisc *cl_q; cl_q = q->queues[cl - 1]; - if (gnet_stats_copy_basic(d, NULL, &cl_q->bstats) < 0 || + if (gnet_stats_copy_basic(d, cl_q->cpu_bstats, &cl_q->bstats) < 0 || gnet_stats_copy_queue(d, NULL, &cl_q->qstats, cl_q->q.qlen) < 0) return -1;