Subject: Re: [PATCH net-next] net/sched: don't use dynamic lockdep keys with clsact/ingress/noqueue

From: Jakub Kicinski <[email-masked]>
Date: Fri, 30 Jan 2026 19:29:21 -0800

On Thu, 29 Jan 2026 16:24:35 +0100 Davide Caratti wrote:
> +static inline void qdisc_lock_init(struct Qdisc *sch, const struct Qdisc_ops *ops)

wrap at 80 please

> +{
> +	bool skip_dynamic_key = (ops->static_flags & TCQ_F_INGRESS) ||
> +				(ops == &noqueue_qdisc_ops);
> +
> +	if (!skip_dynamic_key)
> +		lockdep_register_key(&sch->root_lock_key);
> +
> +	spin_lock_init(&sch->q.lock);
> +	if (!skip_dynamic_key)
> +		lockdep_set_class(&sch->q.lock, &sch->root_lock_key);

is there a reason for the order of things here? The code flow would be
far more natural with:

{
	spin_lock_init(&sch->q.lock);

	/* Skip dynamic keys for qdiscs which can't nest */
	if (ops->static_flags & TCQ_F_INGRESS ||
            ops == &noqueue_qdisc_ops)
		return;

	lockdep_register_key(&sch->root_lock_key);
	lockdep_set_class(&sch->q.lock, &sch->root_lock_key);
}

> +}
> +
> +static inline void qdisc_lock_uninit(struct Qdisc *sch, const struct Qdisc_ops *ops)
> +{
> +	bool skip_dynamic_key = (ops->static_flags & TCQ_F_INGRESS) ||
> +				(ops == &noqueue_qdisc_ops);
> +
> +	if (!skip_dynamic_key)
> +		lockdep_unregister_key(&sch->root_lock_key);
-- 
pw-bot: cr