From: Vlad Poenaru <vlad.wing@gmail.com>
To: Boqun Feng <boqun@kernel.org>, netdev@vger.kernel.org
Cc: Eric Dumazet <edumazet@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Simon Horman <horms@kernel.org>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
Bart Van Assche <bvanassche@acm.org>,
Davide Caratti <dcaratti@redhat.com>,
Breno Leitao <leitao@debian.org>,
Nilay Shroff <nilay@linux.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 0/2] net/sched: don't wait for RCU when destroying qdisc lockdep keys
Date: Tue, 20 Oct 2026 05:53:35 -0700 [thread overview]
Message-ID: <20261020125335.678200-1-vlad.wing@gmail.com> (raw)
In-Reply-To: <atZtYi_Xnz27O8Bp@tardis.local>
On Mon, Oct 19, 2026 at 12:20:02PM -0700, Boqun Feng wrote:
> I think my concern is still valid: for lockdep PoV,
> lockdep_unregister_key_nosync() is an API that users have to use it
> carefully, because it leaves the unregistration process in a stage that
> you need to guarantee that the lockdep key reclamation is delayed by an
> RCU grace period. Or in other words, do you have a way to prevent a user
> from doing lockdep_unregister_key_nosync() but kfree(key), or some sort
> of debugging to find a mis-use?
Not in this version, but lockdep could catch it. Every slab, page and
vmalloc free already goes through debug_check_no_locks_freed(), so:
- lockdep_unregister_key_nosync() records the key together with
get_state_synchronize_rcu() in a small fixed-size table;
- debug_check_no_locks_freed() warns if the freed range contains a
recorded key whose grace period has not elapsed yet
(poll_state_synchronize_rcu()), and retires entries whose grace
period has;
- lockdep_register_key() warns the same way if a recorded key is
reused too early.
The table is empty nearly all the time, so frees only pay for it during
bursts of unregisters. A correct kfree_rcu() or call_rcu() free runs
after the grace period and never warns; lockdep_unregister_key_nosync()
followed by kfree() warns on that kfree().
Would that address your concern? If so I'll add it to v2.
The other way would be for lockdep to keep the dynamic-key hash nodes in
its own storage, freed via RCU like zapped classes, so is_dynamic_key()
never dereferences caller memory and lockdep_unregister_key() needs no
wait at all. That removes the nosync API, but it is a bigger change.
Separately, two corrections to the cover letter: please ignore the
stray "From: Vlad Poenaru <thevlad@meta.com>" line (Eric, sorry for the
confusion; the series is from and signed off by vlad.wing@gmail.com),
and [5] should be:
[5] https://lore.kernel.org/all/20261019170601.805087-1-vlad.wing@gmail.com/
Thanks,
Vlad
next prev parent reply other threads:[~2026-10-20 12:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 17:02 [PATCH net-next 0/2] net/sched: don't wait for RCU when destroying qdisc lockdep keys Vlad Poenaru
2026-10-19 17:02 ` [PATCH net-next 1/2] lockdep: Introduce lockdep_unregister_key_nosync() Vlad Poenaru
2026-10-19 17:38 ` Eric Dumazet
2026-10-19 17:02 ` [PATCH net-next 2/2] net/sched: Don't wait for RCU when unregistering the qdisc lockdep key Vlad Poenaru
2026-10-19 17:37 ` Eric Dumazet
2026-10-19 19:20 ` [PATCH net-next 0/2] net/sched: don't wait for RCU when destroying qdisc lockdep keys Boqun Feng
2026-10-20 12:53 ` Vlad Poenaru [this message]
2026-10-20 17:15 ` Boqun Feng
2026-10-20 17:26 ` Bart Van Assche
2026-10-20 18:12 ` Boqun Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261020125335.678200-1-vlad.wing@gmail.com \
--to=vlad.wing@gmail.com \
--cc=boqun@kernel.org \
--cc=bvanassche@acm.org \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nilay@linux.ibm.com \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.