share nvme trace event helper functions with other modules
Subsystems (2)
PATCH v3 1/2 share nvme trace event helper functions with other modules
Currently the trace.c/trace.h could only be used by nvme-core. This patch moves __assign_disk_name to genhd.h, exports nvme_trace_disk_name to other modules. Thus other nvme modules could also trace disk name.
--- drivers/nvme/host/trace.c | 2 ++ drivers/nvme/host/trace.h | 10 ---------- include/linux/genhd.h | 8 ++++++++ 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/nvme/host/trace.c +2 -0
@@ -139,3 +139,5 @@ const char *nvme_trace_disk_name(struct trace_seq *p, char *name)return ret; } + +EXPORT_SYMBOL_GPL (nvme_trace_disk_name);
drivers/nvme/host/trace.h +0 -10
@@ -82,16 +82,6 @@ const char *nvme_trace_disk_name(struct trace_seq *p, char *name);#define __print_disk_name (name) \ nvme_trace_disk_name(p, name) -#ifndef TRACE_HEADER_MULTI_READ -static inline void __assign_disk_name (char *name,struct gendisk *disk) -{ -if (disk) -memcpy (name, disk->disk_name,DISK_NAME_LEN ); -else -memset (name,0 ,DISK_NAME_LEN ); -} -#endif - TRACE_EVENT(nvme_setup_cmd, TP_PROTO(struct request *req, struct nvme_command *cmd), TP_ARGS(req, cmd),
include/linux/genhd.h +8 -0
@@ -749,6 +749,14 @@ static inline void blk_integrity_add(struct gendisk *disk) { }static inline void blk_integrity_del (struct gendisk *disk) { }#endif /* CONFIG_BLK_DEV_INTEGRITY */ +static inline void __assign_disk_name (char *name,struct gendisk *disk) +{ +if (disk) +memcpy (name, disk->disk_name,DISK_NAME_LEN ); +else +memset (name,0 ,DISK_NAME_LEN ); +} +#else /* CONFIG_BLOCK */ static inline void printk_all_partitions (void ) { }
Signature · 1 line
2.17.1
PATCH v3 2/2 trace nvme submit queue status
export nvme disk name, queue id, sq_head, sq_tail to trace event usage example:
go to the event directory:
cd /sys/kernel/debug/tracing/events/nvme/nvme_sq filter by disk name:
echo 'disk=="nvme1n1"' > filter
enable the event:
echo 1 > enable
check results from trace_pipe:
cat /sys/kernel/debug/tracing/trace_pipe
In practice, this patch help me debug hardware related performant issue.
--- drivers/nvme/host/pci.c | 7 +++++ drivers/nvme/host/trace_pci.h | 57 +++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 drivers/nvme/host/trace_pci.h
drivers/nvme/host/pci.c +7 -0
@@ -32,6 +32,9 @@#include <linux/sed-opal.h> #include <linux/pci-p2pdma.h> +#define CREATE_TRACE_POINTS +#include "trace_pci.h" +#include "nvme.h" #define SQ_SIZE (depth) (depth * sizeof(struct nvme_command))
@@ -899,6 +902,10 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx) } req =blk_mq_tag_to_rq (*nvmeq->tags, cqe->command_id); +trace_nvme_sq (req->rq_disk, + nvmeq->qid, +le16_to_cpu (cqe->sq_head), + nvmeq->sq_tail);nvme_end_request (req, cqe->status, cqe->result); }
drivers/nvme/host/trace_pci.h new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v3 2/2] trace nvme submit queue status
Is the addition of a trace_pci.h really needed? Why can't you just put it in trace.h?
Byte,
Johannes
Signature · 6 lines
Johannes Thumshirn SUSE Labs Filesystems jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Christoph Hellwig
maintainerRe: [PATCH v3 2/2] trace nvme submit queue status
Quoted 2 lines · Johannes Thumshirn
Is the addition of a
trace_pci.hreally needed? Why can't you just put it intrace.h?
Agreed. Especially as the concepts actually are generic, so we could actually add the trace point to the rdma and fc transports as well (not that they would be all that useful, so we probably shouldn't).