Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1905087ybl; Tue, 3 Dec 2019 14:45:47 -0800 (PST) X-Google-Smtp-Source: APXvYqx2PpELLqHyOcMIYfCuq9KQbmKTwZBEhJGqZwNLB2gwvf5tAkn4hNSA5HgMqkAoQOIbSiDo X-Received: by 2002:a9d:7495:: with SMTP id t21mr225048otk.86.1575413146834; Tue, 03 Dec 2019 14:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575413146; cv=none; d=google.com; s=arc-20160816; b=VRW0obzznCt15XPn4kcBRlkUL9nEJFwcRmFx/9e1EBFG2Z3vRlrcAbtX+uQGF6gDvJ JrigYm/tGicgAgppnOCMSx+FEcXzZbBvjdVuSjum0SInYX2C3fJlHWFZiuueOd1rJwA8 8FpcoXkhfYQWljtDKjmBgY1Gz6/35XnD1/g+qFN6yrohSC0rJrAVDX5rYmxQHlD0LMfh +31MC0VqlfW6WwEWz1CcEetieX3F3hAoODADqHgBHHpKSx95qkXD8YWSTTdQBPf5Nf4T 2WGkxGIDaIELneJU3wFpjwTYUIpc8h6rE/ZdC1rhKLGNmW1z3BCKb4EebPGcbkRDX2XH AkLw== 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=szXJ2MWlkqufeeCFGVUb9qkfZHWuryXYnpFN/x6fh64=; b=v0VcTDSHVCJjxZHyNPh83LEb1OWycMHMBqbZERkYnfQeG2rmkVxU1VepAm/DergYXB lbOnmbdcWMZwkeOksUxKppcm1mSEUvpELFuog7iz170JQgVhtmrhp6Cee4RyKM/Pa8cJ OBmOUSTb+5BZgx/Y5zTINslJ4LHLl9HevzyTXsk7KTXo9dEo4u2Y89oA8jInexUbw8/F Xbj9MLtm77z7t7ug0/HVy73BPqnx3zDkUJ58XOmSCoXFoi4tf9NPhSE/t93Ev9h6soEG nfuK7qcprX4bErObbLWFZGOLw46zg3yjToVX/gOOwOSsC71MQG3ZGmfWZhOjhv1wCEg+ 1AZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="iWAncrs/"; 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 t26si1978657oth.153.2019.12.03.14.45.34; Tue, 03 Dec 2019 14:45:46 -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="iWAncrs/"; 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 S1728917AbfLCWoL (ORCPT + 99 others); Tue, 3 Dec 2019 17:44:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:59918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728916AbfLCWoJ (ORCPT ); Tue, 3 Dec 2019 17:44:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 1ADC0206EC; Tue, 3 Dec 2019 22:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413048; bh=2AC5dinst3Ntp9oN+hLsaPSDW5/oiPHCqmHwbgE47Q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iWAncrs/YUm/C/odp0ZrR3mL5kKkiAdaiAIPVJI0kYEx3aCgYfmKMWVzvDCc89PiC doegAZdkdlGFZAWFTlWIpYdZO/8oy15N/xxYH7MuVyLLTLMFOj2+mYYmzn46zLJVx3 lWlKCzu8Ta/sT28ytvOfZsk0gsOsxKHT7r3z0FvY= 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 5.3 115/135] net: sched: fix `tc -s class show` no bstats on class with nolock subqueues Date: Tue, 3 Dec 2019 23:35:55 +0100 Message-Id: <20191203213043.050109353@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203213005.828543156@linuxfoundation.org> References: <20191203213005.828543156@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 | 3 ++- net/sched/sch_mqprio.c | 4 ++-- net/sched/sch_multiq.c | 2 +- net/sched/sch_prio.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) --- a/net/sched/sch_mq.c +++ b/net/sched/sch_mq.c @@ -245,7 +245,8 @@ 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(&sch->running, d, NULL, &sch->bstats) < 0 || + if (gnet_stats_copy_basic(&sch->running, d, sch->cpu_bstats, + &sch->bstats) < 0 || qdisc_qstats_copy(d, sch) < 0) return -1; return 0; --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -557,8 +557,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(qdisc_root_sleeping_running(sch), - d, NULL, &sch->bstats) < 0 || + if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), d, + sch->cpu_bstats, &sch->bstats) < 0 || qdisc_qstats_copy(d, sch) < 0) return -1; } --- a/net/sched/sch_multiq.c +++ b/net/sched/sch_multiq.c @@ -330,7 +330,7 @@ static int multiq_dump_class_stats(struc cl_q = q->queues[cl - 1]; if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), - d, NULL, &cl_q->bstats) < 0 || + d, cl_q->cpu_bstats, &cl_q->bstats) < 0 || qdisc_qstats_copy(d, cl_q) < 0) return -1; --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c @@ -356,7 +356,7 @@ static int prio_dump_class_stats(struct cl_q = q->queues[cl - 1]; if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), - d, NULL, &cl_q->bstats) < 0 || + d, cl_q->cpu_bstats, &cl_q->bstats) < 0 || qdisc_qstats_copy(d, cl_q) < 0) return -1;