Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Kyuwon Cho
Tue, 24 Nov 2026 04:57
[PATCH net] net/sched: sch_cake: use rcu_dereference_bh() in the cake_mq sync loop
Author: Kyuwon Cho
Date: Tue, 24 Nov 2026 04:57
Date: Tue, 24 Nov 2026 04:57
52 lines
12681 bytes
12681 bytes
cake_dequeue() reads the other cake_mq sub-qdiscs with rcu_dereference(),
but it runs from __qdisc_run() under rcu_read_lock_bh() or in softirq
context, not under rcu_read_lock(), so lockdep warns:
WARNING: suspicious RCU usage
net/sched/sch_cake.c:2039 suspicious rcu_dereference_check() usage!
2 locks held by test/114:
#0: ffffffff88b2ca80 (rcu_read_lock_bh){....}-{1:3}, at: __dev_queue_xmit (net/core/dev.c:5014)
#1: ff11000013ec8170 (&sch->root_lock_key){+...}-{3:3}, at: __dev_queue_xmit (net/core/dev.c:5058)
Call Trace:
cake_dequeue (net/sched/sch_cake.c:2039)
__qdisc_run (net/sched/sch_generic.c:359)
__dev_queue_xmit (net/core/dev.c:4502)
packet_sendmsg (net/packet/af_packet.c:3157)
A BH-disabled section is an RCU read-side critical section, so only the
annotation is wrong. Use rcu_dereference_bh(), as cake_classify() does
for the filter list.
Fixes: 1bddd758bac2 ("net/sched: sch_cake: share shaper state across sub-instances of cake_mq")
Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
---
The issue was found by an LLM-guided test generator that we are
developing as a research prototype. Its test runs as an unprivileged
user in its own user and network namespace: it gives a multi-queue veth
a cake_mq root with a rate and sends through a packet socket. With
CONFIG_PROVE_RCU, the warning shows once the shaper sync runs.
The patch was written with LLM assistance; we reviewed and tested it.
With it, the test runs without the warning.
net/sched/sch_cake.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index aa4043d662c1..c1652c0506e1 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -2036,7 +2036,9 @@ static struct sk_buff *cake_dequeue(struct Qdisc *sch)
unsigned int ntx;
for (ntx = 0; ntx < dev->num_tx_queues; ntx++) {
- other_sch = rcu_dereference(netdev_get_tx_queue(dev, ntx)->qdisc_sleeping);
+ struct netdev_queue *txq = netdev_get_tx_queue(dev, ntx);
+
+ other_sch = rcu_dereference_bh(txq->qdisc_sleeping);
other_priv = qdisc_priv(other_sch);
if (other_priv == q)
--
2.43.0
Re: [PATCH net] net/sched: sch_cake: use rcu_dereference_bh() in the cake_mq sync loop
Author: Toke Høiland-Jørgensen
Date: Tue, 24 Nov 2026 10:52
Date: Tue, 24 Nov 2026 10:52
29 lines
9444 bytes
9444 bytes
Kyuwon Cho <kyuwoncho18@gmail.com> writes:
> cake_dequeue() reads the other cake_mq sub-qdiscs with rcu_dereference(),
> but it runs from __qdisc_run() under rcu_read_lock_bh() or in softirq
> context, not under rcu_read_lock(), so lockdep warns:
>
> WARNING: suspicious RCU usage
> net/sched/sch_cake.c:2039 suspicious rcu_dereference_check() usage!
> 2 locks held by test/114:
> #0: ffffffff88b2ca80 (rcu_read_lock_bh){....}-{1:3}, at: __dev_queue_xmit (net/core/dev.c:5014)
> #1: ff11000013ec8170 (&sch->root_lock_key){+...}-{3:3}, at: __dev_queue_xmit (net/core/dev.c:5058)
> Call Trace:
> cake_dequeue (net/sched/sch_cake.c:2039)
> __qdisc_run (net/sched/sch_generic.c:359)
> __dev_queue_xmit (net/core/dev.c:4502)
> packet_sendmsg (net/packet/af_packet.c:3157)
>
> A BH-disabled section is an RCU read-side critical section, so only the
> annotation is wrong. Use rcu_dereference_bh(), as cake_classify() does
> for the filter list.
>
> Fixes: 1bddd758bac2 ("net/sched: sch_cake: share shaper state across sub-instances of cake_mq")
> Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Re: [PATCH net] net/sched: sch_cake: use rcu_dereference_bh() in the cake_mq sync loop
Author: patchwork-bot+netdevbpf
Date: Mon, 30 Nov 2026 03:50
Date: Mon, 30 Nov 2026 03:50
32 lines
9132 bytes
9132 bytes
Hello:
This patch was applied to netdev/net.git (main)
by Willem de Bruijn <willemb@google.com>:
On Tue, 24 Nov 2026 13:57:24 +0900 you wrote:
> cake_dequeue() reads the other cake_mq sub-qdiscs with rcu_dereference(),
> but it runs from __qdisc_run() under rcu_read_lock_bh() or in softirq
> context, not under rcu_read_lock(), so lockdep warns:
>
> WARNING: suspicious RCU usage
> net/sched/sch_cake.c:2039 suspicious rcu_dereference_check() usage!
> 2 locks held by test/114:
> #0: ffffffff88b2ca80 (rcu_read_lock_bh){....}-{1:3}, at: __dev_queue_xmit (net/core/dev.c:5014)
> #1: ff11000013ec8170 (&sch->root_lock_key){+...}-{3:3}, at: __dev_queue_xmit (net/core/dev.c:5058)
> Call Trace:
> cake_dequeue (net/sched/sch_cake.c:2039)
> __qdisc_run (net/sched/sch_generic.c:359)
> __dev_queue_xmit (net/core/dev.c:4502)
> packet_sendmsg (net/packet/af_packet.c:3157)
>
> [...]
Here is the summary with links:
- [net] net/sched: sch_cake: use rcu_dereference_bh() in the cake_mq sync loop
https://git.kernel.org/netdev/net/c/8c9f86c2f55f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads