From: Bart Van Assche <bvanassche@acm.org>
To: Marco Elver <elver@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Boqun Feng <boqun@kernel.org>, Waiman Long <longman@redhat.com>,
linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Steven Rostedt <rostedt@goodmis.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nathan Chancellor <nathan@kernel.org>,
Kees Cook <kees@kernel.org>, Jann Horn <jannh@google.com>
Subject: Re: [PATCH v2 4/4] Revert "lockdep: Annotate lockdep assertions for context analysis"
Date: Wed, 25 Feb 2026 11:27:03 -0800 [thread overview]
Message-ID: <a42900bd-48db-410a-be18-76e2eff6975a@acm.org> (raw)
In-Reply-To: <CANpmjNMnmedf70XK0CNmmiOmgDO+BvJdJpbibrLgTVwN0Je9-w@mail.gmail.com>
On 2/25/26 10:40 AM, Marco Elver wrote:
> On Wed, 25 Feb 2026 at 19:33, Bart Van Assche <bvanassche@acm.org> 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.
This seems to be sufficient to solve the build errors if patch 4/4 is
dropped:
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index b5a5f32fdfd1..9be0a2c8bb40 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -192,6 +192,7 @@ struct kernfs_elem_attr {
* accessible. Dereferencing elem or any other outer entity requires
* active reference.
*/
+context_lock_struct(kernfs_node);
struct kernfs_node {
atomic_t count;
atomic_t active;
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index c5cccc3fc1e8..2977873b84c5 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -14,6 +14,7 @@ struct tty_struct;
/*
* the semaphore definition
*/
+context_lock_struct(ld_semaphore);
struct ld_semaphore {
atomic_long_t count;
raw_spinlock_t wait_lock;
Bart.
next prev parent reply other threads:[~2026-02-25 19:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 18:32 [PATCH v2 0/4] Lock context annotation fixes Bart Van Assche
2026-02-25 18:32 ` [PATCH v2 1/4] locking: Fix rwlock and spinlock lock context annotations Bart Van Assche
2026-02-28 10:56 ` [tip: locking/core] " tip-bot2 for Bart Van Assche
2026-03-12 16:36 ` Bart Van Assche
2026-02-25 18:32 ` [PATCH v2 2/4] signal: Fix the lock_task_sighand() annotation Bart Van Assche
2026-02-28 10:56 ` [tip: locking/core] " tip-bot2 for Bart Van Assche
2026-02-25 18:32 ` [PATCH v2 3/4] ww-mutex: Fix the ww_acquire_ctx function annotations Bart Van Assche
2026-02-28 10:56 ` [tip: locking/core] " tip-bot2 for Bart Van Assche
2026-02-25 18:32 ` [PATCH v2 4/4] Revert "lockdep: Annotate lockdep assertions for context analysis" Bart Van Assche
2026-02-25 18:40 ` Marco Elver
2026-02-25 19:22 ` Marco Elver
2026-02-25 19:27 ` Bart Van Assche [this message]
2026-02-25 18:44 ` [PATCH v2 0/4] Lock context annotation fixes Marco Elver
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=a42900bd-48db-410a-be18-76e2eff6975a@acm.org \
--to=bvanassche@acm.org \
--cc=boqun@kernel.org \
--cc=elver@google.com \
--cc=hch@lst.de \
--cc=jannh@google.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®