]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
mqprio: Correct stats in mqprio_dump_class_stats().
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 7 Oct 2021 17:49:57 +0000 (19:49 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 22 Nov 2021 16:30:59 +0000 (17:30 +0100)
commit098f4f24ad44f453ad63fb2f5568b78da80c5045
tree2caaaf08eb208de666fa2d45757daad68ba6ab3c
parent33c876fe7c225b3259410ff785fb3ed22ad837a1
mqprio: Correct stats in mqprio_dump_class_stats().

BugLink: https://bugs.launchpad.net/bugs/1951291
commit 14132690860e4d06aa3e1c4d7d8e9866ba7756dd upstream.

Introduction of lockless subqueues broke the class statistics.
Before the change stats were accumulated in `bstats' and `qstats'
on the stack which was then copied to struct gnet_dump.

After the change the `bstats' and `qstats' are initialized to 0
and never updated, yet still fed to gnet_dump. The code updates
the global qdisc->cpu_bstats and qdisc->cpu_qstats instead,
clobbering them. Most likely a copy-paste error from the code in
mqprio_dump().

__gnet_stats_copy_basic() and __gnet_stats_copy_queue() accumulate
the values for per-CPU case but for global stats they overwrite
the value, so only stats from the last loop iteration / tc end up
in sch->[bq]stats.

Use the on-stack [bq]stats variables again and add the stats manually
in the global case.

Fixes: ce679e8df7ed2 ("net: sched: add support for TCQ_F_NOLOCK subqueues to sch_mqprio")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
https://lore.kernel.org/all/20211007175000.2334713-2-bigeasy@linutronix.de/
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/sched/sch_mqprio.c