Re: [PATCH v2 4/4] Revert "lockdep: Annotate lockdep assertions for context analysis"

From: Marco Elver

Date: Wed Feb 25 2026 - 14:22:51 EST


On Wed, 25 Feb 2026 at 19:40, Marco Elver <elver@xxxxxxxxxx> wrote:
>
> On Wed, 25 Feb 2026 at 19:33, Bart Van Assche <bvanassche@xxxxxxx> wrote:
> >
> > lockdep_assert_held() supports all data structures that have a member
> > with the name dep_map. __assume_ctx_lock() only supports data structures
> > that support lock context annotation. Remove __assume_ctx_lock() from
> > lockdep_assert_held(). This patch fixes the following build errors if
> > lock context analysis is enabled for the entire kernel tree:
> >
> > drivers/tty/tty_ldisc.c:451:2: error: call to '__assume_ctx_lock' is ambiguous
> > 451 | lockdep_assert_held_write(&tty->ldisc_sem);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > drivers/tty/tty_ldisc.c:451:2: error: call to '__assume_ctx_lock' is ambiguous
> > 451 | lockdep_assert_held_write(&tty->ldisc_sem);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> I think that's a hint that that we should just ld_semaphore a
> first-class context_lock_struct. That will enable the analysis for all
> ld_semaphore users.

If it helps, I did this in an early iteration which resolved the above
issues: https://lore.kernel.org/all/20250304092417.2873893-32-elver@xxxxxxxxxx/

Should work as-is, just needs some renames of the macros which were
renamed since then (and drop the __assert_cap from the init function
which was subsumed by init guards).