Re: [PATCH v3] nvme: Add nvme_setup_cmd to host_path_error

Justin Tee
2026-03-25T18:38:36Z

Hi Minsik,

> - After
> nvme_setup_cmd: \
> nvme0: qid=0, cmdid=32777, nsid=0, flags=0x0, meta=0x0, \
> cmd=(nvme_admin_identify cns=1, ctrlid=0)
> nvme_complete_rq: \
> nvme0: qid=0, cmdid=32777, res=0x0, retries=0, flags=0x2, status=0x370

> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 766e9cc4ffca..378d28b2c971 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -512,6 +512,7 @@ EXPORT_SYMBOL_GPL(nvme_complete_batch_req);
> blk_status_t nvme_host_path_error(struct request *req)
> {
> nvme_req(req)->status = NVME_SC_HOST_PATH_ERROR;
> + nvme_setup_cmd(req->q->queuedata, req);
> blk_mq_set_request_complete(req);
> nvme_complete_rq(req);
> return BLK_STS_OK;

Since trace_nvme_complete_rq is printing only cmdid to help identify
the command, why not define a new TRACE_EVENT(nvme_host_path_error,
...) in trace.h instead?

So, perhaps something like this?

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 5037444687bd..a2e253dbb744 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -511,7 +511,11 @@ EXPORT_SYMBOL_GPL(nvme_complete_batch_req);
*/
blk_status_t nvme_host_path_error(struct request *req)
{
+ struct nvme_command *cmd = nvme_req(req)->cmd;
+
nvme_req(req)->status = NVME_SC_HOST_PATH_ERROR;
+ cmd->common.command_id = nvme_cid(req);
+ trace_nvme_host_path_error(req, cmd);
blk_mq_set_request_complete(req);
nvme_complete_rq(req);
return BLK_STS_OK;

Regards,
Justin