Linux ATA/IDE development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Niklas Cassel" <cassel@kernel.org>
Cc: cassel@kernel.org, dlemoal@kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH 1/3] ata: libata-scsi: Remove lockdep_assert_held() in ata_scsi_translate()
Date: Thu, 28 May 2026 17:51:15 +0000	[thread overview]
Message-ID: <20260528175116.4408A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260528172855.703631-6-cassel@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Removing the runtime `lockdep_assert_held()` assertion weakens dynamic lock verification in favor of static analysis.
--

commit 5b34afedb186c216f09eff8d76c27e0b405885ea
Author: Niklas Cassel <cassel@kernel.org>

ata: libata-scsi: Remove lockdep_assert_held() in ata_scsi_translate()

This commit removes the lockdep_assert_held() check from
ata_scsi_translate(), stating that it suppresses context analysis by
indirectly calling __assume_ctx_lock(). The commit message notes this
will be replaced with context analysis in a follow-up commit.

> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index f44612e269a4d..c31267091662a 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -1852,8 +1852,6 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
>  	struct ata_port *ap = dev->link->ap;
>  	struct ata_queued_cmd *qc;
>  
> -	lockdep_assert_held(ap->lock);
> -

[Severity: Medium]
Is it safe to completely remove this runtime assertion instead of combining
it with the static analysis annotation?

While __assume_ctx_lock() tells the compiler the lock is assumed held inside
the function, the standard practice to statically enforce that the caller
holds the lock is to add __must_hold(ap->lock) to the function signature
while retaining lockdep_assert_held() in the body. Retaining both provides
valuable run-time validation alongside compile-time checks.

Additionally, does removing this check here and introducing the static context
analysis in a follow-up commit temporarily leave this function without any
locking verification during intermediate bisect steps?

>  	/*
>  	 * ata_scsi_qc_new() calls scsi_done(cmd) in case of failure. So we
>  	 * have nothing further to do when allocating a qc fails.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260528172855.703631-5-cassel@kernel.org?part=1

  parent reply	other threads:[~2026-05-28 17:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 17:28 [PATCH 0/3] ata: add __must_hold(ap->lock) annotations in issuing path Niklas Cassel
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 [this message]
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=20260528175116.4408A1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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