Revert "net/sched: fix false lockdep warning on qdisc root lock"

This reverts commit 6d8b2c5206 which is
commit af0cb3fa3f upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: I6775831c67c6b1cc3575f2cbbd2d8a1b285e71d0
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2024-07-01 10:03:10 +00:00
parent b87a1e28af
commit 8ea9c0fc00
3 changed files with 19 additions and 7 deletions

View File

@ -127,7 +127,6 @@ struct Qdisc {
struct rcu_head rcu;
netdevice_tracker dev_tracker;
struct lock_class_key root_lock_key;
ANDROID_KABI_RESERVE(1);

View File

@ -942,9 +942,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
__skb_queue_head_init(&sch->gso_skb);
__skb_queue_head_init(&sch->skb_bad_txq);
gnet_stats_basic_sync_init(&sch->bstats);
lockdep_register_key(&sch->root_lock_key);
spin_lock_init(&sch->q.lock);
lockdep_set_class(&sch->q.lock, &sch->root_lock_key);
if (ops->static_flags & TCQ_F_CPUSTATS) {
sch->cpu_bstats =
@ -1064,7 +1062,6 @@ static void __qdisc_destroy(struct Qdisc *qdisc)
if (ops->destroy)
ops->destroy(qdisc);
lockdep_unregister_key(&qdisc->root_lock_key);
module_put(ops->owner);
netdev_put(qdisc_dev(qdisc), &qdisc->dev_tracker);

View File

@ -1039,6 +1039,13 @@ static void htb_work_func(struct work_struct *work)
rcu_read_unlock();
}
static void htb_set_lockdep_class_child(struct Qdisc *q)
{
static struct lock_class_key child_key;
lockdep_set_class(qdisc_lock(q), &child_key);
}
static int htb_offload(struct net_device *dev, struct tc_htb_qopt_offload *opt)
{
return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_HTB, opt);
@ -1125,6 +1132,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt,
return -ENOMEM;
}
htb_set_lockdep_class_child(qdisc);
q->direct_qdiscs[ntx] = qdisc;
qdisc->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT;
}
@ -1460,6 +1468,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
}
if (q->offload) {
htb_set_lockdep_class_child(new);
/* One ref for cl->leaf.q, the other for dev_queue->qdisc. */
qdisc_refcount_inc(new);
old_q = htb_graft_helper(dev_queue, new);
@ -1724,8 +1733,11 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg,
new_q = qdisc_create_dflt(dev_queue, &pfifo_qdisc_ops,
cl->parent->common.classid,
NULL);
if (q->offload)
if (q->offload) {
if (new_q)
htb_set_lockdep_class_child(new_q);
htb_parent_to_leaf_offload(sch, dev_queue, new_q);
}
}
sch_tree_lock(sch);
@ -1935,9 +1947,13 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
new_q = qdisc_create_dflt(dev_queue, &pfifo_qdisc_ops,
classid, NULL);
if (q->offload) {
/* One ref for cl->leaf.q, the other for dev_queue->qdisc. */
if (new_q)
if (new_q) {
htb_set_lockdep_class_child(new_q);
/* One ref for cl->leaf.q, the other for
* dev_queue->qdisc.
*/
qdisc_refcount_inc(new_q);
}
old_q = htb_graft_helper(dev_queue, new_q);
/* No qdisc_put needed. */
WARN_ON(!(old_q->flags & TCQ_F_BUILTIN));