public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Prevent non-NCQ command starvation
@ 2025-12-17 23:17 Damien Le Moal
  2025-12-17 23:17 ` [PATCH 1/2] ata: libata-scsi: refactor ata_scsi_translate() Damien Le Moal
  2025-12-17 23:17 ` [PATCH 2/2] ata: libata-scsi: avoid passthrough command starvation Damien Le Moal
  0 siblings, 2 replies; 7+ messages in thread
From: Damien Le Moal @ 2025-12-17 23:17 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel; +Cc: Igor Pylypiv, Xingui Yang

This small patch series addresses potential command starvation issues
with non-NCQ passthrough commands issued to a device accessed through
a multi-queue libsas HBA. In such setup, a non-NCQ passthrough command
issued by an application may suffer long delays and even complete
starvation if the device is under constant NCQ read/write workload.

This issue is avoided by limiting the requeing through the block layer
and instead explicitly waiting for the device command queue to drain
before issuing the non-NCQ command. This is done reliably by not trying
to second guess ata EH in case of error or device reset, by always
requeuing a deferred command whenever EH is scheduled for the device
port.

When a non-ncq command is deferred waiting for the device queue to
drain, all new incoming commands are always requeued through the regular
busy mechanism, thus avoiding the need to manage an internal command
queue.

With this, the long latencies observed when executing non-NCQ
passthrough commands under a heavy NCQ read/write workload at high queue
depth is resolved: the non-NCQ command latency only depends on how long
it takes for all in-flight commands to complete.

Damien Le Moal (2):
  ata: libata-scsi: refactor ata_scsi_translate()
  ata: libata-scsi: avoid passthrough command starvation

 drivers/ata/libata-core.c |   1 +
 drivers/ata/libata-eh.c   |   6 ++
 drivers/ata/libata-scsi.c | 155 ++++++++++++++++++++++++++++++++------
 drivers/ata/libata.h      |   2 +
 include/linux/libata.h    |   3 +
 5 files changed, 142 insertions(+), 25 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-12-19  7:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-17 23:17 [PATCH 0/2] Prevent non-NCQ command starvation Damien Le Moal
2025-12-17 23:17 ` [PATCH 1/2] ata: libata-scsi: refactor ata_scsi_translate() Damien Le Moal
2025-12-18  9:23   ` Hannes Reinecke
2025-12-17 23:17 ` [PATCH 2/2] ata: libata-scsi: avoid passthrough command starvation Damien Le Moal
2025-12-18  9:26   ` Hannes Reinecke
2025-12-19  0:08   ` Igor Pylypiv
2025-12-19  7:47     ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox