All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Damien Le Moal <dlemoal@kernel.org>,
	Marco Elver <elver@google.com>,
	linux-block@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Miklos Szeredi <mszeredi@redhat.com>,
	Christian Brauner <brauner@kernel.org>,
	Andreas Gruenbacher <agruenba@redhat.com>,
	Joanne Koong <joannelkoong@gmail.com>,
	Mateusz Guzik <mjguzik@gmail.com>
Subject: Re: [PATCH 03/14] block: Make the lock context annotations compatible with Clang
Date: Wed, 4 Mar 2026 15:34:12 -0600	[thread overview]
Message-ID: <159e66de-5934-4d60-862c-de4dce9afc7d@acm.org> (raw)
In-Reply-To: <aaic_mAZCuC0wZdX@slm.duckdns.org>

On 3/4/26 2:58 PM, Tejun Heo wrote:
> I mean, yeah, static bug detection is nice but is error-prone manual
> annotation the way to do it at this time and age?

Clang verifies the consistency of the annotations with the 
implementation of the annotated function at compile time. Hence, I don't
think that these annotations can be called error-prone.

> These annotations have
> been around for as long as I can remember and I've never once found them
> genuinely useful. Sure, maybe it can flag some latent error path bugs once
> in a blue moon but for the most part they're unused and unmaintained
> appendages that just add to noise.

Agreed that these annotations were not very useful as long as sparse was
the only tool for verifying these annotations. The verification
performed by Clang however seems very useful to me.

> Here's a challenge. Can it reliably and in a sustainable manner capture
> anything that https://github.com/masoncl/review-prompts can't capture?

The above URL points at a repository with AI review prompts. Today's AI
systems are based on LLMs. LLMs suffer from the following issues, issues
that do not apply to Clang's compile-time thread-safety analysis:
* Hallucinations. This means generating grammatically perfect but
   factually incorrect statements.
* The "lost in the middle" phenomenon. Ignoring information that occurs
   in the middle of a long prompt.
* Not being built into the compiler. Clang's thread-safety analysis is
   built into the compiler. Given the computational resources required
   to perform LLM inference, I do not expect AI review prompts to be
   integrated into any C compiler anytime soon.

Here are specific examples of what is possible with the Clang
thread-safety analysis and what falls outside the scope of any code
review software:
* Documenting which synchronization object protects which member
   variable (the __guarded_by() annotation). It can be very difficult
   or even ambiguous to derive from code which synchronization object is
   intended to protect which member variable. The Clang thread-safety
   support allows to annotate member variables with __guarded_by().
* Whether or not it is intentional that some code paths unlock a
   synchronization object and other paths do not. The Clang
   thread-safety annotations include __acquires() and __cond_acquires().
   These annotations not only enable compile time checking of
   synchronization calls but are also useful as documentation to humans.

Bart.

  reply	other threads:[~2026-03-04 21:34 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 19:48 [PATCH 00/14] Enable lock context analysis Bart Van Assche
2026-03-04 19:48 ` [PATCH 01/14] drbd: Balance RCU calls in drbd_adm_dump_devices() Bart Van Assche
2026-03-04 20:25   ` Damien Le Moal
2026-03-04 20:59     ` Bart Van Assche
2026-03-04 19:48 ` [PATCH 02/14] blk-ioc: Prepare for enabling thread-safety analysis Bart Van Assche
2026-03-05 10:10   ` Jan Kara
2026-03-05 12:46     ` Bart Van Assche
2026-03-05 13:18       ` Marco Elver
2026-03-05 14:35         ` Bart Van Assche
2026-03-05 20:30           ` Marco Elver
2026-03-04 19:48 ` [PATCH 03/14] block: Make the lock context annotations compatible with Clang Bart Van Assche
2026-03-04 20:03   ` Tejun Heo
2026-03-04 20:29     ` Bart Van Assche
2026-03-04 20:58       ` Tejun Heo
2026-03-04 21:34         ` Bart Van Assche [this message]
2026-03-04 21:45           ` Tejun Heo
2026-03-04 21:46             ` Tejun Heo
2026-03-04 19:48 ` [PATCH 04/14] aoe: Add a lock context annotation Bart Van Assche
2026-03-04 19:48 ` [PATCH 05/14] drbd: Make the lock context annotations compatible with Clang Bart Van Assche
2026-03-09 10:08   ` Christoph Böhmwalder
2026-03-09 23:15     ` Bart Van Assche
2026-03-11 20:42       ` Christoph Böhmwalder
2026-03-04 19:48 ` [PATCH 06/14] loop: Add lock context annotations Bart Van Assche
2026-03-04 19:48 ` [PATCH 07/14] nbd: " Bart Van Assche
2026-03-04 19:48 ` [PATCH 08/14] null_blk: Add more " Bart Van Assche
2026-03-04 19:48 ` [PATCH 09/14] rbd: Add " Bart Van Assche
2026-03-04 19:48 ` [PATCH 10/14] rnbd: Add more " Bart Van Assche
2026-03-06 13:09   ` Marco Elver
2026-03-06 14:11     ` Bart Van Assche
2026-03-04 19:48 ` [PATCH 11/14] ublk: Fix the " Bart Van Assche
2026-03-04 20:43   ` Caleb Sander Mateos
2026-03-04 20:55     ` Bart Van Assche
2026-03-04 21:03       ` Caleb Sander Mateos
2026-03-04 21:36         ` Bart Van Assche
2026-03-04 19:48 ` [PATCH 12/14] zloop: Add a " Bart Van Assche
2026-03-04 19:48 ` [PATCH 13/14] zram: Add " Bart Van Assche
2026-03-05  1:23   ` Sergey Senozhatsky
2026-03-04 19:48 ` [PATCH 14/14] block: Enable lock context analysis for all block drivers Bart Van Assche
2026-03-05  1:33   ` Sergey Senozhatsky

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=159e66de-5934-4d60-862c-de4dce9afc7d@acm.org \
    --to=bvanassche@acm.org \
    --cc=agruenba@redhat.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dlemoal@kernel.org \
    --cc=elver@google.com \
    --cc=hch@lst.de \
    --cc=joannelkoong@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mjguzik@gmail.com \
    --cc=mszeredi@redhat.com \
    --cc=nathan@kernel.org \
    --cc=tj@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.