nvme host complete request tracing

Sagi Grimberg sagi at grimberg.me
Thu May 18 02:18:09 PDT 2023


> Hello,
> 
> nvme/host/core.c trace_nvme_complete_rq() is being called immediately when entering nvme_complete_rq()
> As I understand it, the idea behind this trace is to trace every single nvme request that is being completed.
> but this is actually not accurate since there are several options for a request as part of this function:
> COMPLETE, RETRY, FAILOVER

Well, it is completing this particular request.

> In order to better understand the status per nvme request I think it’s better to have a separate trace per each case, something like:
> trace_nvme_end_rq(req), trace_nvme_retry_rq(req), trace_nvme_failover_rq(req) etc.

Maybe we can add the disposition to the trace?

Something like:
--
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b374e6007553..eaf03ff61224 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -393,14 +393,17 @@ static inline void nvme_end_req(struct request *req)
  void nvme_complete_rq(struct request *req)
  {
         struct nvme_ctrl *ctrl = nvme_req(req)->ctrl;
+       enum nvme_disposition disposition;

-       trace_nvme_complete_rq(req);
         nvme_cleanup_cmd(req);

         if (ctrl->kas)
                 ctrl->comp_seen = true;

-       switch (nvme_decide_disposition(req)) {
+       disposition = nvme_decide_disposition(req);
+       trace_nvme_complete_rq(req, disposition);
+
+       switch (disposition) {
         case COMPLETE:
                 nvme_end_req(req);
                 return;
--



More information about the Linux-nvme mailing list