From: minwoo.im.dev@gmail.com (Minwoo Im)
Subject: [RFC PATCH V7 5/7] nvme: trace: filter out unnecessary fields for fabrics
Date: Fri, 7 Jun 2019 04:45:10 +0900 [thread overview]
Message-ID: <20190606194512.11020-6-minwoo.im.dev@gmail.com> (raw)
In-Reply-To: <20190606194512.11020-1-minwoo.im.dev@gmail.com>
If the given command is for fabrics command, then it should not print
out the following fields which are for the !fabrics commands:
1) "flags" (FUSE, PSDT).
2) "nsid" which is reserved in fabrics command.
3) "metadata" which is also reserved in fabrics.
To make !fabrics commands clear, don't print them out in case of fabrics
commands.
Examples:
1) !fabrics commands (e.g. read):
nvme_setup_cmd: nvme1: disk=nvme1c1n1, qid=5, cmdid=65, nsid=0x1, flags=0x40, meta=0x0 cmd=(nvme_cmd_read slba=0, len=7, ctrl=0x0, dsmgmt=0, reftag=0)
2) fabrics commands (e.g. connect):
nvme_setup_cmd: nvme1: qid=0, cmdid=0 cmd=(nvme_fabrics_type_connect recfmt=0, qid=0, sqsize=31, cattr=0, kato=15000)
Cc: Keith Busch <kbusch at kernel.org>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Sagi Grimberg <sagi at grimberg.me>
Signed-off-by: Minwoo Im <minwoo.im.dev at gmail.com>
---
drivers/nvme/host/trace.c | 20 ++++++++++++++++++++
drivers/nvme/host/trace.h | 20 +++++++++++---------
2 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
index 02c09774ad91..e5e695b0db80 100644
--- a/drivers/nvme/host/trace.c
+++ b/drivers/nvme/host/trace.c
@@ -213,4 +213,24 @@ const char *nvme_trace_disk_name(struct trace_seq *p, char *name)
return ret;
}
+const char *nvme_trace_parse_common(struct trace_seq *p,
+ struct nvme_command *cmd)
+{
+ const char *ret = trace_seq_buffer_ptr(p);
+
+ /*
+ * Fabrics command capsule does not have the following fields which
+ * is for !fabrics commands.
+ */
+ if (!nvme_is_fabrics(cmd)) {
+ trace_seq_printf(p, ", nsid=%#x, flags=%#x, meta=%#llx",
+ le32_to_cpu(cmd->common.nsid),
+ cmd->common.flags,
+ le64_to_cpu(cmd->common.metadata));
+ }
+ trace_seq_putc(p, 0);
+
+ return ret;
+}
+
EXPORT_TRACEPOINT_SYMBOL_GPL(nvme_sq);
diff --git a/drivers/nvme/host/trace.h b/drivers/nvme/host/trace.h
index da45cef2c31c..fd90fc8fd3f7 100644
--- a/drivers/nvme/host/trace.h
+++ b/drivers/nvme/host/trace.h
@@ -16,6 +16,12 @@
#include "nvme.h"
+const char *nvme_trace_parse_common(struct trace_seq *p,
+ struct nvme_command *cmd);
+
+#define parse_nvme_common(cmd) \
+ nvme_trace_parse_common(p, cmd)
+
const char *nvme_trace_parse_admin_cmd(struct trace_seq *p, u8 opcode,
u8 *cdw10);
const char *nvme_trace_parse_nvm_cmd(struct trace_seq *p, u8 opcode,
@@ -48,34 +54,30 @@ TRACE_EVENT(nvme_setup_cmd,
TP_PROTO(struct request *req, struct nvme_command *cmd),
TP_ARGS(req, cmd),
TP_STRUCT__entry(
+ __field(struct nvme_command *, cmd)
__array(char, disk, DISK_NAME_LEN)
__field(int, ctrl_id)
__field(int, qid)
__field(u8, opcode)
- __field(u8, flags)
__field(u8, fctype)
__field(u16, cid)
- __field(u32, nsid)
- __field(u64, metadata)
__array(u8, cdw10, 24)
),
TP_fast_assign(
+ __entry->cmd = cmd;
__entry->ctrl_id = nvme_req(req)->ctrl->instance;
__entry->qid = nvme_req_qid(req);
__entry->opcode = cmd->common.opcode;
- __entry->flags = cmd->common.flags;
__entry->cid = le16_to_cpu(cmd->common.command_id);
- __entry->nsid = le32_to_cpu(cmd->common.nsid);
- __entry->metadata = le64_to_cpu(cmd->common.metadata);
__entry->fctype = cmd->fabrics.fctype;
__assign_disk_name(__entry->disk, req->rq_disk);
memcpy(__entry->cdw10, &cmd->common.cdw10,
sizeof(__entry->cdw10));
),
- TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)",
+ TP_printk("nvme%d: %sqid=%d, cmdid=%u%s cmd=(%s %s)",
__entry->ctrl_id, __print_disk_name(__entry->disk),
- __entry->qid, __entry->cid, __entry->nsid,
- __entry->flags, __entry->metadata,
+ __entry->qid, __entry->cid,
+ parse_nvme_common(__entry->cmd),
show_opcode_name(__entry->qid, __entry->opcode,
__entry->fctype),
parse_nvme_cmd(__entry->qid, __entry->opcode,
--
2.21.0
next prev parent reply other threads:[~2019-06-06 19:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 19:45 [RFC PATCH V7 0/7] nvme-trace: Add support for fabrics command Minwoo Im
2019-06-06 19:45 ` [RFC PATCH V7 1/7] nvme: trace: do not EXPORT_SYMBOL for a trace function Minwoo Im
2019-06-06 19:45 ` [RFC PATCH V7 2/7] nvme: trace: move opcode symbol print to nvme.h Minwoo Im
2019-06-07 16:46 ` Christoph Hellwig
2019-06-08 1:57 ` Minwoo Im
2019-06-06 19:45 ` [RFC PATCH V7 3/7] nvme: trace: put cid with le16_to_cpu() Minwoo Im
2019-06-07 16:47 ` Christoph Hellwig
2019-06-08 1:35 ` Minwoo Im
2019-06-06 19:45 ` [RFC PATCH V7 4/7] nvme: trace: support for fabrics commands in host-side Minwoo Im
2019-06-07 16:51 ` Christoph Hellwig
2019-06-08 1:37 ` Minwoo Im
2019-06-06 19:45 ` Minwoo Im [this message]
2019-06-07 16:52 ` [RFC PATCH V7 5/7] nvme: trace: filter out unnecessary fields for fabrics Christoph Hellwig
2019-06-08 1:38 ` Minwoo Im
2019-06-06 19:45 ` [RFC PATCH V7 6/7] nvme: trace: print result and status in hex format Minwoo Im
2019-06-07 16:53 ` Christoph Hellwig
2019-06-06 19:45 ` [RFC PATCH V7 7/7] nvmet: introduce target-side trace Minwoo Im
2019-06-07 16:54 ` Christoph Hellwig
2019-06-08 1:49 ` Minwoo Im
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190606194512.11020-6-minwoo.im.dev@gmail.com \
--to=minwoo.im.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.