* [PATCH] net: sched: fix `tc -s class show` no bstats on class with nolock subqueues
@ 2019-11-28 6:29 Dust Li
2019-11-30 5:17 ` Cong Wang
2019-11-30 18:44 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Dust Li @ 2019-11-28 6:29 UTC (permalink / raw)
To: Jamal Hadi Salim, Cong Wang, Jiri Pirko, John Fastabend
Cc: Tony Lu, Paolo Abeni, netdev
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>
---
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(-)
diff --git a/net/sched/sch_mq.c b/net/sched/sch_mq.c
index 0d578333e967..278c0b2dc523 100644
--- a/net/sched/sch_mq.c
+++ b/net/sched/sch_mq.c
@@ -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;
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index 46980b8d66c5..0d0113a24962 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -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;
}
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c
index b2b7fdb06fc6..1330ad224931 100644
--- a/net/sched/sch_multiq.c
+++ b/net/sched/sch_multiq.c
@@ -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;
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 0f8fedb8809a..18b884cfdfe8 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -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;
--
2.19.1.3.ge56e4f7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: sched: fix `tc -s class show` no bstats on class with nolock subqueues
2019-11-28 6:29 [PATCH] net: sched: fix `tc -s class show` no bstats on class with nolock subqueues Dust Li
@ 2019-11-30 5:17 ` Cong Wang
2019-11-30 18:44 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Cong Wang @ 2019-11-30 5:17 UTC (permalink / raw)
To: Dust Li
Cc: Jamal Hadi Salim, Jiri Pirko, John Fastabend, Tony Lu,
Paolo Abeni, Linux Kernel Network Developers
On Wed, Nov 27, 2019 at 10:29 PM Dust Li <dust.li@linux.alibaba.com> wrote:
>
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: sched: fix `tc -s class show` no bstats on class with nolock subqueues
2019-11-28 6:29 [PATCH] net: sched: fix `tc -s class show` no bstats on class with nolock subqueues Dust Li
2019-11-30 5:17 ` Cong Wang
@ 2019-11-30 18:44 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-11-30 18:44 UTC (permalink / raw)
To: dust.li; +Cc: jhs, xiyou.wangcong, jiri, john.fastabend, tonylu, pabeni, netdev
From: Dust Li <dust.li@linux.alibaba.com>
Date: Thu, 28 Nov 2019 14:29:09 +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>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-30 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28 6:29 [PATCH] net: sched: fix `tc -s class show` no bstats on class with nolock subqueues Dust Li
2019-11-30 5:17 ` Cong Wang
2019-11-30 18:44 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).