Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp819981ybl; Wed, 4 Dec 2019 11:24:34 -0800 (PST) X-Google-Smtp-Source: APXvYqyqXknXChVQ6Sjb7rW734HEBcm+Hs8pTDBfj68V61BFJiWCV5WZfByR7wcpxL2qwnbMAE1a X-Received: by 2002:a9d:3e43:: with SMTP id h3mr3716303otg.84.1575487474523; Wed, 04 Dec 2019 11:24:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575487474; cv=none; d=google.com; s=arc-20160816; b=zU3FaauUROScw63NuerFvdE1H5pc+pjiZqqACu2O4viTpThVN7ks9epSg5HP4qx1LJ 0JJILshLUBd8QhioKFSsKfHTsO1/M6EHtinfjA1WmH5d6OAOQ/5K2B4q5bDrL/sdQ0uD FqFpMeyWfkefIquRfepUk0TWDKPKjYsD8scXQPxxCwEl7Ig7cKJCpPan50H4nTXBRedp fbk/ne+nvfs7hGDKAGJiVY1ugEQ2CA6qKCD/S/mXhvmm+L7i+HE0Eh9/R1jF2D9fDtSu h2xzUWzxeDD26XB5X2wtDR2W3g5uCEdIjqaiCf16x2L4RtD5rNAi4FIXxfvPE+8UZ6Up GunQ== 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=4N1LIL6YO6+QBybekLZEvh1gZ7hPrr8Q3BiboMzDVyc=; b=wm6Jgryst8qVwV/TExMju5okSDXHxExMz4pI3jKEFSeSZaB2Dl+YfZFOR9LVihewqA QV2H6rlDokoVOWDtH56QfYA2vPgx2sb+YPZlDTzFjau5pqS0uFhu+B6BA1kkh/iqYgQC KjNoQmU2kf+LVBxSakqKABOCOJmwGq454v+gKnNlp+Sac8nxMsQ4ErRx9cQoVcM0OckZ 4t8Cxuof27kAHyZeXPfkzXUsn7eHnUOjPEkC1eTbDqTcITywv94auv5O97pnqWbaT10C KCflvTuq/1eQ0qM05Ech0Dl42KkJ5GP41cmXrM7J+A39rt+CaDy4LiEMP/pNbrXsKCDh hF5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wj3biG7S; 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 u30si2274154otj.268.2019.12.04.11.24.22; Wed, 04 Dec 2019 11:24:34 -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=wj3biG7S; 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 S1730895AbfLDSIX (ORCPT + 99 others); Wed, 4 Dec 2019 13:08:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:59788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730885AbfLDSIQ (ORCPT ); Wed, 4 Dec 2019 13:08:16 -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 8A81320675; Wed, 4 Dec 2019 18:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482896; bh=GKrDquQmMc8HbmJnc35y54RKrxR7EJFTx2TQSEMwkZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wj3biG7SsbsUcjFhHT4VNUxsQWCyAIS5Q4po/L/A/6ho8LBWquaoDoN5eMR9rnklW eY5OWwR5KhhwG3j2wTyk0dufGkU3mSCAdev2K9PddDzyRNqZVAWR/xKQ4Gy2hRy7G1 9d7kgphPqwKx3NheNGPWFLPT0z5wqPPpr9ymroZY= 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.14 177/209] net: sched: fix `tc -s class show` no bstats on class with nolock subqueues Date: Wed, 4 Dec 2019 18:56:29 +0100 Message-Id: <20191204175335.671731498@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@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 @@ -191,7 +191,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 || 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 @@ -366,8 +366,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 || 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 @@ -340,7 +340,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 || 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 @@ -298,7 +298,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 || gnet_stats_copy_queue(d, NULL, &cl_q->qstats, cl_q->q.qlen) < 0) return -1;