Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Bart Van Assche <bvanassche@acm.org>, Niklas Cassel <cassel@kernel.org>
Cc: linux-ide@vger.kernel.org, Marco Elver <elver@google.com>,
	Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Viresh Kumar <vireshk@kernel.org>,
	Mikael Pettersson <mikpelinux@gmail.com>,
	Nathan Chancellor <nathan@kernel.org>
Subject: Re: [PATCH v3] ata: libata: Document when host->eh_mutex should be held
Date: Thu, 28 May 2026 07:28:48 +0900	[thread overview]
Message-ID: <35f1d7c8-8425-4d51-90ff-d217289cdca1@kernel.org> (raw)
In-Reply-To: <e95c0eb43a8297c9ab5e220341512882f8648512.1779913278.git.bvanassche@acm.org>

On 5/28/26 05:25, Bart Van Assche wrote:
> Annotate the following functions with __must_hold(&host->eh_mutex):
>  * All ata_port_operations.error_handler() implementations.
>  * ata_eh_reset() and ata_eh_recover() because these functions call
>    ata_eh_release() and ata_eh_acquire().
>  * All callers of ata_eh_reset() and ata_eh_recover().
> 
> Enable Clang's context analysis. This will cause the build to fail if
> e.g. a locking bug would be introduced in an error path. This patch
> should not affect the generated assembler code.
> 
> Note: although the Linux kernel documentation specifies 22 as minimal
> version for Clang for context analysis support, annotating function
> pointers is a Clang 23 feature. As one can see here, a patch has been
> queued that fixes the kernel documentation:
> https://lore.kernel.org/all/177926568868.711.3058599932884307249.tip-bot2@tip-bot2/
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Bart,

Thanks for doing this.
I only have a couple of nits below. With that fixed, please add:

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

> +		/* Tell the compiler that link->ap == ap. */
> +		lockdep_assert_held(&link->ap->host->eh_mutex);

Please drop this comment in the 2 places you have it. The comment is confusing
because it does not describe at all what lockdep_assert_held() checks. No
comment is fine. lockdep_assert_held() as a name is clear enough.

> +	/* Tell the compiler that ap->link.ap == ap. */
> +	lockdep_assert_held(&ap->link.ap->host->eh_mutex);

Same thing here.

-- 
Damien Le Moal
Western Digital Research

  parent reply	other threads:[~2026-05-27 22:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 20:25 [PATCH v3] ata: libata: Document when host->eh_mutex should be held Bart Van Assche
2026-05-27 20:55 ` Niklas Cassel
2026-05-27 21:09   ` Bart Van Assche
2026-05-27 20:57 ` sashiko-bot
2026-05-28  6:57   ` Niklas Cassel
2026-05-27 22:28 ` Damien Le Moal [this message]
2026-05-28  6:58 ` Hannes Reinecke

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=35f1d7c8-8425-4d51-90ff-d217289cdca1@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=bvanassche@acm.org \
    --cc=cassel@kernel.org \
    --cc=elver@google.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=mikpelinux@gmail.com \
    --cc=nathan@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=vireshk@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