Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <cassel@kernel.org>, Tommy Kelly <linux@tkel.ly>,
	John Garry <john.g.garry@oracle.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH v5 3/4] ata: libata-scsi: do not use the deferred QC feature on PMPs with CBS
Date: Mon, 18 May 2026 11:23:04 +0200	[thread overview]
Message-ID: <a93e6459-97ba-4d42-bbb8-e813c3607d4a@kernel.org> (raw)
In-Reply-To: <20260514073858.1175072-9-cassel@kernel.org>

On 2026/05/14 9:39, Niklas Cassel wrote:
> When using Port Multipliers (PMPs) with Command-Based Switching (CBS), you
> can only issue commands to one link at a time. For PMPs with CBS, there is
> already code to handle commands being sent to different links in
> sata_pmp_qc_defer_cmd_switch() using ap->excl_link. sata_sil24 also makes
> use of ap->excl_link.
> 
> A user on the list reported that commit 0ea84089dbf6 ("ata: libata-scsi:
> avoid Non-NCQ command starvation") broke PMPs with CBS. The commit
> introduced code that stores a deferred qc in ap->deferred_qc, to later be
> issued via a workqueue. It turns out that this change is incompatible with
> the existing ap->excl_link handling used by PMPs with CBS.
> 
> Thus, modify sata_pmp_qc_defer_cmd_switch() and sil24_qc_defer() to return
> ATA_DEFER_LINK_EXCL, and make sure that the deferred QC handling via
> workqueue is not used for this return value.
> 
> This way, PMPs with CBS will work once again. Note that the starvation
> referenced in commit 0ea84089dbf6 ("ata: libata-scsi: avoid Non-NCQ
> command starvation") can only happen on libsas ports, and libsas does not
> support Port Multipliers, thus there is no harm of reverting back to the
> previous way of deferring commands for PMPs with CBS.
> 
> Non-libsas ports connected to anything but a PMP with CBS (e.g. a normal
> drive or a PMP with FBS) will continue using the deferred workqueue, since
> it does result in lower completion latencies for non-NCQ commands, even
> though the workqueue is not strictly needed to avoid starvation for
> non-libsas ports.
> 
> If we want to modify the scope of the workqueue issuing to also handle
> PMPs with CBS, then we should ensure that we can save both NCQ and non-NCQ
> commands in ap->deferred_qc, while also removing the existing PMP CBS
> handling using ap->excl_link, such that we don't duplicate features.
> 
> While at it, also add a comment explaining how the ap->excl_link mechanism
> works.
> 
> Fixes: 0ea84089dbf6 ("ata: libata-scsi: avoid Non-NCQ command starvation")
> Signed-off-by: Niklas Cassel <cassel@kernel.org>

Looks good.

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


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-05-18  9:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14  7:38 [PATCH v5 0/4] ata: fix deferred QC handling for port multipliers Niklas Cassel
2026-05-14  7:38 ` [PATCH v5 1/4] ata: libata-scsi: improve readability of ata_scsi_qc_issue() Niklas Cassel
2026-05-18  9:19   ` Damien Le Moal
2026-05-14  7:39 ` [PATCH v5 2/4] ata: libata-scsi: do not use the deferred QC feature for ATA_DEFER_PORT Niklas Cassel
2026-05-18  9:20   ` Damien Le Moal
2026-05-14  7:39 ` [PATCH v5 3/4] ata: libata-scsi: do not use the deferred QC feature on PMPs with CBS Niklas Cassel
2026-05-18  9:23   ` Damien Le Moal [this message]
2026-05-14  7:39 ` [PATCH v5 4/4] ata: libata-scsi: do not needlessly defer commands when using PMP with FBS Niklas Cassel
2026-05-18  9:24   ` Damien Le Moal
2026-05-14 10:43 ` [PATCH v5 0/4] ata: fix deferred QC handling for port multipliers Tommy Kelly
2026-05-14 11:17   ` Niklas Cassel
2026-05-18 10:33   ` Niklas Cassel
2026-05-18 10:37 ` 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=a93e6459-97ba-4d42-bbb8-e813c3607d4a@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=cassel@kernel.org \
    --cc=john.g.garry@oracle.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux@tkel.ly \
    --cc=martin.petersen@oracle.com \
    /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