From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Bart Van Assche <bvanassche@acm.org>,
Marco Elver <elver@google.com>,
linux-ide@vger.kernel.org, Niklas Cassel <cassel@kernel.org>
Subject: [PATCH 0/3] ata: add __must_hold(ap->lock) annotations in issuing path
Date: Thu, 28 May 2026 19:28:56 +0200 [thread overview]
Message-ID: <20260528172855.703631-5-cassel@kernel.org> (raw)
Hello all,
This series is meant to be applied on top of Bart's patch that already sets:
CONTEXT_ANALYSIS := y
and adds __must_hold(ap->host->eh_mutex) for EH functions.
This adds __must_hold(ap->lock) annotations in the issuing path.
This only adds annotations to a small number of functions.
Additional functions can be annotated later.
By only annotating the issuing path, we are not blocked by first needing to
fix some of the ata_port_freeze() callers not taking the lock.
I tried to look at nv_do_interrupt(), but AFAICT, it does take the lock.
I much prefer adding a "struct ata_port *ap" parameter to the issuing functions,
because it avoids the problem that the context analysis cannot recognize that
qc->ap == ap. (Since it relies on static code analysis.)
Because the alternative, adding a bunch of lockdep_assert_held() before a
function call to a function annotated with __must_held(), simply tells the
compiler to assume that the lock is held (because the lockdep_assert_held()
macro has a call to __assume_ctx_lock()).
By adding an ap parameter, there is no need to assume any lock context,
it can be verified all the way from the function taking the lock.
Kind regards,
Niklas
Bart Van Assche (2):
ata: libata: Pass ap parameter directly to functions in the issuing
path
ata: Annotate functions in the issuing path with __must_hold()
Niklas Cassel (1):
ata: libata-scsi: Remove lockdep_assert_held() in ata_scsi_translate()
drivers/ata/libata-core.c | 6 +++---
drivers/ata/libata-sata.c | 3 ++-
drivers/ata/libata-scsi.c | 20 ++++++++++----------
drivers/ata/libata.h | 7 +++++--
include/linux/libata.h | 3 ++-
5 files changed, 22 insertions(+), 17 deletions(-)
--
2.54.0
next reply other threads:[~2026-05-28 17:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 17:28 Niklas Cassel [this message]
2026-05-28 17:28 ` [PATCH 1/3] ata: libata-scsi: Remove lockdep_assert_held() in ata_scsi_translate() Niklas Cassel
2026-05-28 17:33 ` Bart Van Assche
2026-05-28 17:54 ` Niklas Cassel
2026-05-28 19:48 ` Bart Van Assche
2026-05-28 17:51 ` sashiko-bot
2026-05-29 6:22 ` Hannes Reinecke
2026-05-29 6:42 ` Damien Le Moal
2026-05-28 17:28 ` [PATCH 2/3] ata: libata: Pass ap parameter directly to functions in the issuing path Niklas Cassel
2026-05-29 6:22 ` Hannes Reinecke
2026-05-28 17:28 ` [PATCH 3/3] ata: Annotate functions in the issuing path with __must_hold() Niklas Cassel
2026-05-29 6:23 ` 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=20260528172855.703631-5-cassel@kernel.org \
--to=cassel@kernel.org \
--cc=bvanassche@acm.org \
--cc=dlemoal@kernel.org \
--cc=elver@google.com \
--cc=linux-ide@vger.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