nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
PATCH 1/1 nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
From: Bean Huo <[email protected]>
The I/O Command Set specific Identify Controller (CNS 06h) is only defined in NVMe 2.0 and later. Pre-2.0 controllers return an Invalid Field error for this command, which shows up as noise in the NVMe error log visible via nvme-cli. Avoid sending a command that is guaranteed to fail by checking the controller version upfront.
Note that the analogous CNS 05h (I/O Command Set specific Identify Namespace) is intentionally not gated on version, as commit 823340b7e877 ("nvme: always issue I/O Command Set specific Identify Namespace") allows pre-2.0 controllers to optionally implement it with graceful error handling.
--- drivers/nvme/host/core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/nvme/host/core.c +6 -0
@@ -3400,7 +3400,13 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)else ctrl->max_zeroes_sectors =0 ; +/* +* I/O Command Set specific Identify Controller (CNS 06h) is only +* defined in NVMe 2.0 and later. Sending it to pre-2.0 controllers +* results in an Invalid Field error from the device. +*/ if (!nvme_is_io_ctrl (ctrl) || + ctrl->vs <NVME_VS (2 ,0 ,0 ) || !nvme_id_cns_ok (ctrl,NVME_ID_CNS_CS_CTRL ) ||test_bit (NVME_CTRL_SKIP_ID_CNS_CS , &ctrl->flags))return 0 ;
Signature · 1 line
2.34.1
Christoph Hellwig
maintainerNo. NVMe allow TPs to be implemented on devices claiming earlier compliance. We've had this patch and this answer probably half a dozen times now.
Keith Busch
maintainerQuoted 3 lines · Christoph Hellwig
No. NVMe allow TPs to be implemented on devices claiming earlier compliance. We've had this patch and this answer probably half a dozen times now.
The proper solution is that vendors need to have their controllers stop logging pointless errors that don't help anything.
Quoted 7 lines · Keith Busch
Quoted 3 lines · Christoph Hellwig
No. NVMe allow TPs to be implemented on devices claiming earlier compliance. We've had this patch and this answer probably half a dozen times now.
The proper solution is that vendors need to have their controllers stop logging pointless errors that don't help anything.
Thanks Christoph, Keith.
I wasn't aware that TPs can be implemented independently of the spec version claimed by the device. I'll drop this patch and follow up with the vendor instead.
Kind regards,
Bean