]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: sched: fix `tc -s class show` no bstats on class with nolock subqueues
authorDust Li <dust.li@linux.alibaba.com>
Thu, 28 Nov 2019 06:29:09 +0000 (14:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 14:27:16 +0000 (15:27 +0100)
[ 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 <dust.li@linux.alibaba.com>
Signed-off-by: Tony Lu <tonylu@linux.alibaba.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/sch_mq.c
net/sched/sch_mqprio.c
net/sched/sch_multiq.c
net/sched/sch_prio.c

index d9c84328e7ebb2c01b6d266a3843ab24ce8beb80..b34992808879a7929344e41b33505ac09ede0c77 100644 (file)
@@ -195,7 +195,7 @@ static int mq_dump_class_stats(struct Qdisc *sch, unsigned long cl,
        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;
index 66bccc5ff4ea962e601ada91b5a76d9979d8fb78..03c19adb2e6183f950a122c21efd269af0bc852d 100644 (file)
@@ -355,7 +355,8 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
                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;
index cef36ad691dd5c08eecdb993ed67a8f4e7b4462b..be3d78357fbb188807f3cc41e281cfe5e5364345 100644 (file)
@@ -351,7 +351,7 @@ static int multiq_dump_class_stats(struct Qdisc *sch, unsigned long cl,
        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;
 
index fee1b15506b299755c685502a4a33283b458fef5..ca9fb2b0c14a959cc3dcc42453b17963eff3f32f 100644 (file)
@@ -319,7 +319,7 @@ static int prio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
        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;