]> asedeno.scripts.mit.edu Git - linux.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)
committerDavid S. Miller <davem@davemloft.net>
Sat, 30 Nov 2019 18:38:40 +0000 (10:38 -0800)
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>
net/sched/sch_mq.c
net/sched/sch_mqprio.c
net/sched/sch_multiq.c
net/sched/sch_prio.c

index 0d578333e967edb99e209c8f21412fbe5ee38986..278c0b2dc523cdef6ea003be5611cf9380a3a5c6 100644 (file)
@@ -245,7 +245,8 @@ 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(&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;
index 46980b8d66c5ba74e9b5d46bf5a2179c33517f77..0d0113a24962848e958fd7e058b5b5d32f071ff4 100644 (file)
@@ -557,8 +557,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(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;
        }
index b2b7fdb06fc62a7325ed573dd856ef81cde9159a..1330ad2249317ccfdb81777c5ac4c56f3f500a64 100644 (file)
@@ -339,7 +339,7 @@ static int multiq_dump_class_stats(struct Qdisc *sch, unsigned long cl,
 
        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;
 
index 0f8fedb8809ae40d69e4aedf0cb1ce4899eeec99..18b884cfdfe8de12223dfa3f8058b8c31726a885 100644 (file)
@@ -356,7 +356,7 @@ static int prio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
 
        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;