Linux ATA/IDE development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bart Van Assche" <bvanassche@acm.org>
Cc: dlemoal@kernel.org, linux-ide@vger.kernel.org, cassel@kernel.org
Subject: Re: [PATCH v2 4/9] ata: libata: Pass the ATA port argument directly to ata_qc_complete()
Date: Thu, 21 May 2026 18:40:35 +0000	[thread overview]
Message-ID: <20260521184035.DAD131F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260521173347.2079560-5-bvanassche@acm.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] The kernel-doc comment for ata_qc_complete() is missing the new '@ap' parameter.

Pre-existing issues:
- [High] In `sata_fsl_host_intr`, a spurious interrupt will prematurely complete an active internal command.
--

commit 0bfdcf1e846fdd4f2753f05417c311388a3aa360
Author: Bart Van Assche <bvanassche@acm.org>
ata: libata: Pass the ATA port argument directly to ata_qc_complete()

This commit prepares for adding lock context annotations by passing the ATA
port argument directly to ata_qc_complete(). No functional changes were made.

> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 5caae9a2aca39..307ab48fe04c2 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -5024,9 +5024,8 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc)
>   *	LOCKING:
>   *	spin_lock_irqsave(host lock)
>   */
> -void ata_qc_complete(struct ata_queued_cmd *qc)
> +void ata_qc_complete(struct ata_port *ap, struct ata_queued_cmd *qc)
>  {

[Severity: Low]
Is the kernel-doc block missing the new @ap parameter? Since this is an
exported symbol, omitting the new parameter might trigger kernel-doc
warnings during documentation builds.

> -	struct ata_port *ap = qc->ap;
>  	struct ata_device *dev = qc->dev;
>  	struct ata_eh_info *ehi = &dev->link->eh_info;

[ ... ]

> diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
> index be829fcc584de..ce6f50b8e38c1 100644
> --- a/drivers/ata/sata_fsl.c
> +++ b/drivers/ata/sata_fsl.c
> @@ -1264,7 +1264,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
>  			 ioread32(hcr_base + CC));
>  
>  		if (qc) {
> -			ata_qc_complete(qc);
> +			ata_qc_complete(ap, qc);
>  		}

[Severity: High]
This is a pre-existing issue, but does this code prematurely complete an
active internal command on a spurious interrupt?

When an internal command is active, ap->qc_active has bit 32 set
(ATA_TAG_INTERNAL). The done_mask is a 32-bit value read from the CC
register, so it cannot have bit 32 set. Consequently,
done_mask & ap->qc_active always evaluates to 0.

The driver then falls back to the else if block this hunk modifies, which
blindly assumes the internal command completed without verifying that the
completion bit in CC is actually set. If a non-error or spurious interrupt
arrives while an internal command is in flight, it appears the driver
will incorrectly complete the command before the hardware finishes processing
it.

>  	} else {
>  		/* Spurious Interrupt!! */

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260521173347.2079560-1-bvanassche@acm.org?part=4

  reply	other threads:[~2026-05-21 18:40 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 17:33 [PATCH v2 0/9] ata: libata-core: Enable context analysis Bart Van Assche
2026-05-21 17:33 ` [PATCH v2 1/9] ata: libata: Fix ata_exec_internal() Bart Van Assche
2026-05-26 13:43   ` Niklas Cassel
2026-05-26 15:56     ` Bart Van Assche
2026-05-27  9:17       ` Niklas Cassel
2026-05-27 18:31   ` Damien Le Moal
2026-05-28  6:10   ` Hannes Reinecke
2026-05-21 17:33 ` [PATCH v2 2/9] ata: libata: Pass the ATA port argument directly to __ata_scsi_queuecmd() Bart Van Assche
2026-05-26 15:07   ` Niklas Cassel
2026-05-26 21:46     ` Bart Van Assche
2026-05-27 10:44       ` Niklas Cassel
2026-05-27 18:43   ` Damien Le Moal
2026-05-27 18:55     ` Bart Van Assche
2026-05-27 19:32       ` Damien Le Moal
2026-05-28  6:11   ` Hannes Reinecke
2026-05-21 17:33 ` [PATCH v2 3/9] ata: libata: Pass the ATA port argument directly to ata_qc_schedule_eh() Bart Van Assche
2026-05-21 17:33 ` [PATCH v2 4/9] ata: libata: Pass the ATA port argument directly to ata_qc_complete() Bart Van Assche
2026-05-21 18:40   ` sashiko-bot [this message]
2026-05-21 20:30     ` Bart Van Assche
2026-05-26 13:23       ` Niklas Cassel
2026-05-21 17:33 ` [PATCH v2 5/9] ata: libata: Pass the ATA port argument directly to ata_qc_issue() Bart Van Assche
2026-05-21 18:56   ` sashiko-bot
2026-05-21 17:33 ` [PATCH v2 6/9] ata: libata: Pass the ATA port argument directly to __ata_qc_complete() Bart Van Assche
2026-05-21 17:33 ` [PATCH v2 7/9] ata: libata: Pass the ATA port argument directly to ata_link_abort() Bart Van Assche
2026-05-21 19:14   ` sashiko-bot
2026-05-21 17:33 ` [PATCH v2 8/9] ata: libata: Enable context analysis Bart Van Assche
2026-05-21 20:17   ` sashiko-bot
2026-05-21 20:31     ` Bart Van Assche
2026-05-27 10:48   ` Niklas Cassel
2026-05-21 17:33 ` [PATCH v2 9/9] ata: Annotate the code that uses the host lock Bart Van Assche
2026-05-21 20:38   ` sashiko-bot
2026-05-26 15:16   ` Niklas Cassel
2026-05-26 21:33     ` Bart Van Assche
2026-05-26 22:37       ` Damien Le Moal
2026-05-26 22:40       ` Marco Elver
2026-05-27 13:42         ` Niklas Cassel
2026-05-27 10:57   ` Niklas Cassel
2026-05-27 18:51   ` Damien Le Moal
2026-05-27 18:54     ` Bart Van Assche
2026-05-27 19:34       ` Damien Le Moal
2026-05-27  9:20 ` (subset) [PATCH v2 0/9] ata: libata-core: Enable context analysis Niklas Cassel

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=20260521184035.DAD131F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bvanassche@acm.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