Re: [PATCH 00/14] Stop lockdep_assert_held*() from assuming lock ownership

From: Marco Elver

Date: Fri Nov 13 2026 - 07:02:49 EST


On Wed, 11 Nov 2026 at 22:05, Bart Van Assche <bvanassche@xxxxxxx> wrote:
>
> On 11/11/26 11:14 AM, Marco Elver wrote:
> > The point was that the Coccinelle script could be used to add those
> > annotations tree-wide. We do not need to make the lockdep API worse,
> > if the legacy-code problem is solved another way.
>
> Coccinelle is way too slow to be run every time the kernel is built
> and hence is impractical for implementing compile-time checks. I'm
> not claiming that what I'm proposing is ideal but the approach I'm

Making global kernel APIs non-ideal has generally been rejected,
because it's a long-term global change and rolling it back is very
hard. I see the 2 paths as:

1. more checking and coverage *right now*; worse API *long-term*;
2. less checking and coverage *right now*; better API kept, and more
checking and coverage *long-term* through the Coccinelle script.

> proposing ensures that all lock context checking happens at build time
> and doesn't increase the build time noticeably.

I think it's as simple as running the Coccinelle script, applying the
__must_hold* annotations that fall out of it globally, and we're done.
In a few months we can run it again and see what else has appeared,
but we should converge to 99% functions properly annotated and can
move on.