{"id":2175861,"url":"http://patchwork.ozlabs.org/api/1.0/covers/2175861/?format=json","project":{"id":13,"url":"http://patchwork.ozlabs.org/api/1.0/projects/13/?format=json","name":"Linux IDE development","link_name":"linux-ide","list_id":"linux-ide.vger.kernel.org","list_email":"linux-ide@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20251219075134.501727-1-dlemoal@kernel.org>","date":"2025-12-19T07:51:32","name":"[v2,0/2] Prevent non-NCQ command starvation","submitter":{"id":86188,"url":"http://patchwork.ozlabs.org/api/1.0/people/86188/?format=json","name":"Damien Le Moal","email":"dlemoal@kernel.org"},"series":[{"id":485960,"url":"http://patchwork.ozlabs.org/api/1.0/series/485960/?format=json","date":"2025-12-19T07:51:32","name":"Prevent non-NCQ command starvation","version":2,"mbox":"http://patchwork.ozlabs.org/series/485960/mbox/"}],"headers":{"Return-Path":"\n <linux-ide+bounces-4805-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ide@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=HgNmPJM5;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ide+bounces-4805-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"HgNmPJM5\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dXfyd5wmkz1y2r\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 19 Dec 2025 18:57:29 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id E731830133A9\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 19 Dec 2025 07:56:04 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id A8E18280CFC;\n\tFri, 19 Dec 2025 07:56:03 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 50D68246BBA\n\tfor <linux-ide@vger.kernel.org>; Fri, 19 Dec 2025 07:56:03 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 52078C4CEF1;\n\tFri, 19 Dec 2025 07:56:02 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1766130963; cv=none;\n b=BocANYtXoIkDxsqv7dpNZ36BcuuAKWfdMbQmGLOGtFwXjv9AoU38pO8HWZ4ZZwg+ctAgwVAVtnNGidTdUpjL0DGKPcix/YK+h/KlZRr2L3HPCP/xSwe8m7scJHGiZ+HJajRUTmDFALvPTJ6f7WF7LbB29OTWrY7f1p/06hWEbD8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1766130963; c=relaxed/simple;\n\tbh=AIQk4X6JTJ2itdxzkjIxo0J1p1QI9N1upJO2vlnBsSs=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=JjZCsoxo7zczBdpDzWMUxxs46kWtbLjrEOZgT1YsVgkHebWWOZOXLDBPrhsgggOmsGEn/10inoOlbg1Zqe4cb/+vULA8vMInDrA++exLOZCH34LN4ZkmdRV3XCNPizoCylvquNtMko+2lJw6Db6d5s0/ga5EG26W6wxv1B6PF4g=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=HgNmPJM5; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1766130962;\n\tbh=AIQk4X6JTJ2itdxzkjIxo0J1p1QI9N1upJO2vlnBsSs=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=HgNmPJM5uvOpZLee/xrG4NCmaxgs56kfcsh2MUqCNVO81GaPWacwgnoAX2HxcGA+p\n\t DuSiXzLJhUUj1EgGsK3Om7UbXDUiqk3f9rOwmPWfkmnqJzjWGJ0KVvTePJ7i/w/PKU\n\t cG2N81Kq0LfyO20ftEm9Ywl9mn2r7m8LchU2uLepa5duq/CSkJ3JCwEtCsnRzbN62m\n\t OjowSQVWM+Nd56UW1KFruLC/isMWM4j4y7T+KTOBmO+gtf1soYJ8ohZ+T20UqoFy1A\n\t XTuyG43nzJA/3lA/jSIczeZcxts3zk6kYJNPJuUjpNMBemYFgIJxwmsKVl0c+sYYyv\n\t z805HTOnq0sBw==","From":"Damien Le Moal <dlemoal@kernel.org>","To":"linux-ide@vger.kernel.org,\n\tNiklas Cassel <cassel@kernel.org>","Cc":"Igor Pylypiv <ipylypiv@google.com>,\n\tXingui Yang <yangxingui@huawei.com>","Subject":"[PATCH v2 0/2] Prevent non-NCQ command starvation","Date":"Fri, 19 Dec 2025 16:51:32 +0900","Message-ID":"<20251219075134.501727-1-dlemoal@kernel.org>","X-Mailer":"git-send-email 2.52.0","Precedence":"bulk","X-Mailing-List":"linux-ide@vger.kernel.org","List-Id":"<linux-ide.vger.kernel.org>","List-Subscribe":"<mailto:linux-ide+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ide+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"This small patch series addresses potential command starvation issues\nwith non-NCQ passthrough commands issued to a device accessed through\na multi-queue libsas HBA. In such setup, a non-NCQ passthrough command\nissued by an application may suffer long delays and even complete\nstarvation if the device is under constant NCQ read/write workload.\n\nThis issue is avoided by limiting the requeing through the block layer\nand instead explicitly waiting for the device command queue to drain\nbefore issuing the non-NCQ command. This is done reliably by not trying\nto second guess ata EH in case of error or device reset, by always\nrequeuing a deferred command whenever EH is scheduled for the device\nport.\n\nWhen a non-ncq command is deferred waiting for the device queue to\ndrain, all new incoming commands are always requeued through the regular\nbusy mechanism, thus avoiding the need to manage an internal command\nqueue.\n\nWith this, the long latencies observed when executing non-NCQ\npassthrough commands under a heavy NCQ read/write workload at high queue\ndepth is resolved: the non-NCQ command latency only depends on how long\nit takes for all in-flight commands to complete.\n\nChanges from v1:\n - Fixed ac leak in ata_scsi_defer() in patch 2.\n - Added Hannes review tag\n\nDamien Le Moal (2):\n  ata: libata-scsi: refactor ata_scsi_translate()\n  ata: libata-scsi: avoid passthrough command starvation\n\n drivers/ata/libata-core.c |   1 +\n drivers/ata/libata-eh.c   |   6 ++\n drivers/ata/libata-scsi.c | 157 ++++++++++++++++++++++++++++++++------\n drivers/ata/libata.h      |   2 +\n include/linux/libata.h    |   3 +\n 5 files changed, 144 insertions(+), 25 deletions(-)"}