public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Marco Elver <elver@google.com>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Damien Le Moal <dlemoal@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>
Subject: Re: [PATCH v3 02/12] block/bdev: Annotate the blk_holder_ops callback invocations
Date: Mon, 13 Apr 2026 09:06:07 -0700	[thread overview]
Message-ID: <2a2c46fb-c934-4ecc-b3cb-4e4114a6d6bf@acm.org> (raw)
In-Reply-To: <CANpmjNONpHgSzavkbqdbM2N0oCtt2_2+UqBCMWjMaWEcWrCy4w@mail.gmail.com>

On 4/12/26 11:00 PM, Marco Elver wrote:
> For now, that's intended - focus is on getting rid of false positives.
> Doing what you suggest above would require abusing the attributes to
> effectively become type qualifiers; that's generally questionable,
> because that's not what attributes are meant to do (and reworking TSA
> to provide real type-qualifiers is an intrusion into the type system
> that's also a hard sell). So for now, I'll try to do the simpler
> change, and later may look into adding -Wthread-safety specific
> warnings that points out such mismatches.

Is there agreement that the Linux kernel Clang build shouldn't break, no
matter what version of Clang is used to build the kernel (ignoring Clang
bugs)? If so, I think we either need a new macro to annotate function
pointers or thread-safety checking has to be disabled for Clang versions
that do not support annotating function pointers.

If I annotate function pointers with __releases() then the following
error message is reported with a Clang compiler built from the LLVM main
branch:

In file included from block/blk-core.c:16:
In file included from ./include/linux/module.h:20:
In file included from ./include/linux/elf.h:6:
In file included from ./arch/x86/include/asm/elf.h:10:
In file included from ./arch/x86/include/asm/ia32.h:7:
In file included from ./include/linux/compat.h:17:
./include/linux/fs.h:2309:55: error: use of undeclared identifier 'sb'
  2309 |         void (*kill_sb) (struct super_block *sb) 
__releases(&sb->s_umount);
       |

How to prevent such error messages? Is adding the capability to the
Linux kernel to detect whether or not annotating function pointers is
supported and introducing a new macro for annotating function pointers
the only solution?

Additionally, the __release() annotations introduced by this patch will
have to be surrounded by an #ifdef/#endif pair or thread-safety checking
in the Linux kernel will have to be disabled for Clang versions that do
not support adding attributes to function pointers.

Thanks,

Bart.



  reply	other threads:[~2026-04-13 16:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 18:39 [PATCH v3 00/12] Enable lock context analysis Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 01/12] block: Annotate the queue limits functions Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 02/12] block/bdev: Annotate the blk_holder_ops callback invocations Bart Van Assche
2026-04-09  6:42   ` Christoph Hellwig
2026-04-09 13:27     ` Marco Elver
2026-04-10 17:17       ` Bart Van Assche
2026-04-10 22:43         ` Marco Elver
2026-04-10 23:44           ` Bart Van Assche
2026-04-13  6:00             ` Marco Elver
2026-04-13 16:06               ` Bart Van Assche [this message]
2026-04-13 20:03                 ` Marco Elver
2026-04-02 18:39 ` [PATCH v3 03/12] block/cgroup: Split blkg_conf_prep() Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 04/12] block/cgroup: Split blkg_conf_exit() Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 05/12] block/cgroup: Inline blkg_conf_{open,close}_bdev_frozen() Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 06/12] block/crypto: Annotate the crypto functions Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 07/12] block/blk-iocost: Add lock context annotations Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 08/12] block/blk-mq-debugfs: Improve " Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 09/12] block/blk-zoned: Refactor blkdev_zone_mgmt_ioctl() Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 10/12] block/kyber: Make the lock context annotations compatible with Clang Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 11/12] block/mq-deadline: " Bart Van Assche
2026-04-02 18:39 ` [PATCH v3 12/12] block: Enable lock context analysis Bart Van Assche
2026-04-03  0:19 ` [PATCH v3 00/12] " Chaitanya Kulkarni

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=2a2c46fb-c934-4ecc-b3cb-4e4114a6d6bf@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=elver@google.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=nathan@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