2019-02-18 16:36:29 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
nvme: add tracepoint for nvme_setup_cmd
Add tracepoints for nvme_setup_cmd() for tracing admin and/or nvm commands.
Examples of the two tracepoints are as follows for trace_nvme_setup_admin_cmd():
kworker/u8:0-5 [003] .... 2.998792: nvme_setup_admin_cmd: cmdid=14, flags=0x0, meta=0x0, cmd=(nvme_admin_create_cq cqid=1, qsize=1023, cq_flags=0x3, irq_vector=0)
and trace_nvme_setup_nvm_cmd():
dd-205 [001] .... 3.503929: nvme_setup_nvm_cmd: qid=1, nsid=1, cmdid=989, flags=0x0, meta=0x0, cmd=(nvme_cmd_read slba=4096, len=2047, ctrl=0x0, dsmgmt=0, reftag=0)
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-01-26 18:21:37 +08:00
|
|
|
/*
|
|
|
|
* NVM Express device driver tracepoints
|
|
|
|
* Copyright (c) 2018 Johannes Thumshirn, SUSE Linux GmbH
|
|
|
|
*/
|
|
|
|
|
|
|
|
#undef TRACE_SYSTEM
|
|
|
|
#define TRACE_SYSTEM nvme
|
|
|
|
|
|
|
|
#if !defined(_TRACE_NVME_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
|
|
#define _TRACE_NVME_H
|
|
|
|
|
|
|
|
#include <linux/nvme.h>
|
|
|
|
#include <linux/tracepoint.h>
|
|
|
|
#include <linux/trace_seq.h>
|
|
|
|
|
|
|
|
#include "nvme.h"
|
|
|
|
|
2018-06-30 06:50:01 +08:00
|
|
|
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,
|
|
|
|
u8 *cdw10);
|
2019-06-12 20:45:31 +08:00
|
|
|
const char *nvme_trace_parse_fabrics_cmd(struct trace_seq *p, u8 fctype,
|
|
|
|
u8 *spc);
|
nvme: add tracepoint for nvme_setup_cmd
Add tracepoints for nvme_setup_cmd() for tracing admin and/or nvm commands.
Examples of the two tracepoints are as follows for trace_nvme_setup_admin_cmd():
kworker/u8:0-5 [003] .... 2.998792: nvme_setup_admin_cmd: cmdid=14, flags=0x0, meta=0x0, cmd=(nvme_admin_create_cq cqid=1, qsize=1023, cq_flags=0x3, irq_vector=0)
and trace_nvme_setup_nvm_cmd():
dd-205 [001] .... 3.503929: nvme_setup_nvm_cmd: qid=1, nsid=1, cmdid=989, flags=0x0, meta=0x0, cmd=(nvme_cmd_read slba=4096, len=2047, ctrl=0x0, dsmgmt=0, reftag=0)
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-01-26 18:21:37 +08:00
|
|
|
|
2019-06-12 20:45:31 +08:00
|
|
|
#define parse_nvme_cmd(qid, opcode, fctype, cdw10) \
|
|
|
|
((opcode) == nvme_fabrics_command ? \
|
|
|
|
nvme_trace_parse_fabrics_cmd(p, fctype, cdw10) : \
|
|
|
|
((qid) ? \
|
|
|
|
nvme_trace_parse_nvm_cmd(p, opcode, cdw10) : \
|
|
|
|
nvme_trace_parse_admin_cmd(p, opcode, cdw10)))
|
nvme: add tracepoint for nvme_setup_cmd
Add tracepoints for nvme_setup_cmd() for tracing admin and/or nvm commands.
Examples of the two tracepoints are as follows for trace_nvme_setup_admin_cmd():
kworker/u8:0-5 [003] .... 2.998792: nvme_setup_admin_cmd: cmdid=14, flags=0x0, meta=0x0, cmd=(nvme_admin_create_cq cqid=1, qsize=1023, cq_flags=0x3, irq_vector=0)
and trace_nvme_setup_nvm_cmd():
dd-205 [001] .... 3.503929: nvme_setup_nvm_cmd: qid=1, nsid=1, cmdid=989, flags=0x0, meta=0x0, cmd=(nvme_cmd_read slba=4096, len=2047, ctrl=0x0, dsmgmt=0, reftag=0)
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-01-26 18:21:37 +08:00
|
|
|
|
2018-06-30 06:50:03 +08:00
|
|
|
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
|
|
|
|
|
2018-06-30 06:50:01 +08:00
|
|
|
TRACE_EVENT(nvme_setup_cmd,
|
|
|
|
TP_PROTO(struct request *req, struct nvme_command *cmd),
|
|
|
|
TP_ARGS(req, cmd),
|
nvme: add tracepoint for nvme_setup_cmd
Add tracepoints for nvme_setup_cmd() for tracing admin and/or nvm commands.
Examples of the two tracepoints are as follows for trace_nvme_setup_admin_cmd():
kworker/u8:0-5 [003] .... 2.998792: nvme_setup_admin_cmd: cmdid=14, flags=0x0, meta=0x0, cmd=(nvme_admin_create_cq cqid=1, qsize=1023, cq_flags=0x3, irq_vector=0)
and trace_nvme_setup_nvm_cmd():
dd-205 [001] .... 3.503929: nvme_setup_nvm_cmd: qid=1, nsid=1, cmdid=989, flags=0x0, meta=0x0, cmd=(nvme_cmd_read slba=4096, len=2047, ctrl=0x0, dsmgmt=0, reftag=0)
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-01-26 18:21:37 +08:00
|
|
|
TP_STRUCT__entry(
|
2018-06-30 06:50:03 +08:00
|
|
|
__array(char, disk, DISK_NAME_LEN)
|
2018-07-02 23:15:03 +08:00
|
|
|
__field(int, ctrl_id)
|
2018-06-30 06:50:01 +08:00
|
|
|
__field(int, qid)
|
|
|
|
__field(u8, opcode)
|
|
|
|
__field(u8, flags)
|
2019-06-12 20:45:31 +08:00
|
|
|
__field(u8, fctype)
|
2018-06-30 06:50:01 +08:00
|
|
|
__field(u16, cid)
|
|
|
|
__field(u32, nsid)
|
|
|
|
__field(u64, metadata)
|
|
|
|
__array(u8, cdw10, 24)
|
nvme: add tracepoint for nvme_setup_cmd
Add tracepoints for nvme_setup_cmd() for tracing admin and/or nvm commands.
Examples of the two tracepoints are as follows for trace_nvme_setup_admin_cmd():
kworker/u8:0-5 [003] .... 2.998792: nvme_setup_admin_cmd: cmdid=14, flags=0x0, meta=0x0, cmd=(nvme_admin_create_cq cqid=1, qsize=1023, cq_flags=0x3, irq_vector=0)
and trace_nvme_setup_nvm_cmd():
dd-205 [001] .... 3.503929: nvme_setup_nvm_cmd: qid=1, nsid=1, cmdid=989, flags=0x0, meta=0x0, cmd=(nvme_cmd_read slba=4096, len=2047, ctrl=0x0, dsmgmt=0, reftag=0)
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-01-26 18:21:37 +08:00
|
|
|
),
|
|
|
|
TP_fast_assign(
|
2018-07-02 23:15:03 +08:00
|
|
|
__entry->ctrl_id = nvme_req(req)->ctrl->instance;
|
2018-06-30 06:50:01 +08:00
|
|
|
__entry->qid = nvme_req_qid(req);
|
|
|
|
__entry->opcode = cmd->common.opcode;
|
|
|
|
__entry->flags = cmd->common.flags;
|
|
|
|
__entry->cid = cmd->common.command_id;
|
|
|
|
__entry->nsid = le32_to_cpu(cmd->common.nsid);
|
|
|
|
__entry->metadata = le64_to_cpu(cmd->common.metadata);
|
2019-06-12 20:45:31 +08:00
|
|
|
__entry->fctype = cmd->fabrics.fctype;
|
2018-06-30 06:50:03 +08:00
|
|
|
__assign_disk_name(__entry->disk, req->rq_disk);
|
2018-12-13 07:11:37 +08:00
|
|
|
memcpy(__entry->cdw10, &cmd->common.cdw10,
|
2019-03-14 01:54:56 +08:00
|
|
|
sizeof(__entry->cdw10));
|
nvme: add tracepoint for nvme_setup_cmd
Add tracepoints for nvme_setup_cmd() for tracing admin and/or nvm commands.
Examples of the two tracepoints are as follows for trace_nvme_setup_admin_cmd():
kworker/u8:0-5 [003] .... 2.998792: nvme_setup_admin_cmd: cmdid=14, flags=0x0, meta=0x0, cmd=(nvme_admin_create_cq cqid=1, qsize=1023, cq_flags=0x3, irq_vector=0)
and trace_nvme_setup_nvm_cmd():
dd-205 [001] .... 3.503929: nvme_setup_nvm_cmd: qid=1, nsid=1, cmdid=989, flags=0x0, meta=0x0, cmd=(nvme_cmd_read slba=4096, len=2047, ctrl=0x0, dsmgmt=0, reftag=0)
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-01-26 18:21:37 +08:00
|
|
|
),
|
2018-06-30 06:50:03 +08:00
|
|
|
TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)",
|
|
|
|
__entry->ctrl_id, __print_disk_name(__entry->disk),
|
|
|
|
__entry->qid, __entry->cid, __entry->nsid,
|
|
|
|
__entry->flags, __entry->metadata,
|
2019-06-12 20:45:31 +08:00
|
|
|
show_opcode_name(__entry->qid, __entry->opcode,
|
|
|
|
__entry->fctype),
|
|
|
|
parse_nvme_cmd(__entry->qid, __entry->opcode,
|
|
|
|
__entry->fctype, __entry->cdw10))
|
nvme: add tracepoint for nvme_setup_cmd
Add tracepoints for nvme_setup_cmd() for tracing admin and/or nvm commands.
Examples of the two tracepoints are as follows for trace_nvme_setup_admin_cmd():
kworker/u8:0-5 [003] .... 2.998792: nvme_setup_admin_cmd: cmdid=14, flags=0x0, meta=0x0, cmd=(nvme_admin_create_cq cqid=1, qsize=1023, cq_flags=0x3, irq_vector=0)
and trace_nvme_setup_nvm_cmd():
dd-205 [001] .... 3.503929: nvme_setup_nvm_cmd: qid=1, nsid=1, cmdid=989, flags=0x0, meta=0x0, cmd=(nvme_cmd_read slba=4096, len=2047, ctrl=0x0, dsmgmt=0, reftag=0)
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-01-26 18:21:37 +08:00
|
|
|
);
|
|
|
|
|
2018-01-26 18:21:38 +08:00
|
|
|
TRACE_EVENT(nvme_complete_rq,
|
|
|
|
TP_PROTO(struct request *req),
|
|
|
|
TP_ARGS(req),
|
|
|
|
TP_STRUCT__entry(
|
2018-06-30 06:50:03 +08:00
|
|
|
__array(char, disk, DISK_NAME_LEN)
|
2018-07-02 23:15:03 +08:00
|
|
|
__field(int, ctrl_id)
|
2018-06-30 06:50:01 +08:00
|
|
|
__field(int, qid)
|
|
|
|
__field(int, cid)
|
|
|
|
__field(u64, result)
|
|
|
|
__field(u8, retries)
|
|
|
|
__field(u8, flags)
|
|
|
|
__field(u16, status)
|
2018-01-26 18:21:38 +08:00
|
|
|
),
|
|
|
|
TP_fast_assign(
|
2018-07-02 23:15:03 +08:00
|
|
|
__entry->ctrl_id = nvme_req(req)->ctrl->instance;
|
2018-06-30 06:50:01 +08:00
|
|
|
__entry->qid = nvme_req_qid(req);
|
|
|
|
__entry->cid = req->tag;
|
|
|
|
__entry->result = le64_to_cpu(nvme_req(req)->result.u64);
|
|
|
|
__entry->retries = nvme_req(req)->retries;
|
|
|
|
__entry->flags = nvme_req(req)->flags;
|
|
|
|
__entry->status = nvme_req(req)->status;
|
2018-06-30 06:50:03 +08:00
|
|
|
__assign_disk_name(__entry->disk, req->rq_disk);
|
2018-01-26 18:21:38 +08:00
|
|
|
),
|
2019-06-12 20:45:32 +08:00
|
|
|
TP_printk("nvme%d: %sqid=%d, cmdid=%u, res=%#llx, retries=%u, flags=0x%x, status=%#x",
|
2018-06-30 06:50:03 +08:00
|
|
|
__entry->ctrl_id, __print_disk_name(__entry->disk),
|
|
|
|
__entry->qid, __entry->cid, __entry->result,
|
|
|
|
__entry->retries, __entry->flags, __entry->status)
|
2018-01-26 18:21:38 +08:00
|
|
|
|
|
|
|
);
|
|
|
|
|
2018-09-18 01:47:06 +08:00
|
|
|
#define aer_name(aer) { aer, #aer }
|
|
|
|
|
|
|
|
TRACE_EVENT(nvme_async_event,
|
|
|
|
TP_PROTO(struct nvme_ctrl *ctrl, u32 result),
|
|
|
|
TP_ARGS(ctrl, result),
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(int, ctrl_id)
|
|
|
|
__field(u32, result)
|
|
|
|
),
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->ctrl_id = ctrl->instance;
|
|
|
|
__entry->result = result;
|
|
|
|
),
|
|
|
|
TP_printk("nvme%d: NVME_AEN=%#08x [%s]",
|
|
|
|
__entry->ctrl_id, __entry->result,
|
|
|
|
__print_symbolic(__entry->result,
|
|
|
|
aer_name(NVME_AER_NOTICE_NS_CHANGED),
|
|
|
|
aer_name(NVME_AER_NOTICE_ANA),
|
|
|
|
aer_name(NVME_AER_NOTICE_FW_ACT_STARTING),
|
2019-05-14 01:46:05 +08:00
|
|
|
aer_name(NVME_AER_NOTICE_DISC_CHANGED),
|
2018-09-18 01:47:06 +08:00
|
|
|
aer_name(NVME_AER_ERROR),
|
|
|
|
aer_name(NVME_AER_SMART),
|
|
|
|
aer_name(NVME_AER_CSS),
|
|
|
|
aer_name(NVME_AER_VS))
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
#undef aer_name
|
|
|
|
|
2018-12-19 00:59:53 +08:00
|
|
|
TRACE_EVENT(nvme_sq,
|
|
|
|
TP_PROTO(struct request *req, __le16 sq_head, int sq_tail),
|
|
|
|
TP_ARGS(req, sq_head, sq_tail),
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(int, ctrl_id)
|
|
|
|
__array(char, disk, DISK_NAME_LEN)
|
|
|
|
__field(int, qid)
|
|
|
|
__field(u16, sq_head)
|
|
|
|
__field(u16, sq_tail)
|
|
|
|
),
|
|
|
|
TP_fast_assign(
|
|
|
|
__entry->ctrl_id = nvme_req(req)->ctrl->instance;
|
|
|
|
__assign_disk_name(__entry->disk, req->rq_disk);
|
|
|
|
__entry->qid = nvme_req_qid(req);
|
|
|
|
__entry->sq_head = le16_to_cpu(sq_head);
|
|
|
|
__entry->sq_tail = sq_tail;
|
|
|
|
),
|
|
|
|
TP_printk("nvme%d: %sqid=%d, head=%u, tail=%u",
|
|
|
|
__entry->ctrl_id, __print_disk_name(__entry->disk),
|
|
|
|
__entry->qid, __entry->sq_head, __entry->sq_tail
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
nvme: add tracepoint for nvme_setup_cmd
Add tracepoints for nvme_setup_cmd() for tracing admin and/or nvm commands.
Examples of the two tracepoints are as follows for trace_nvme_setup_admin_cmd():
kworker/u8:0-5 [003] .... 2.998792: nvme_setup_admin_cmd: cmdid=14, flags=0x0, meta=0x0, cmd=(nvme_admin_create_cq cqid=1, qsize=1023, cq_flags=0x3, irq_vector=0)
and trace_nvme_setup_nvm_cmd():
dd-205 [001] .... 3.503929: nvme_setup_nvm_cmd: qid=1, nsid=1, cmdid=989, flags=0x0, meta=0x0, cmd=(nvme_cmd_read slba=4096, len=2047, ctrl=0x0, dsmgmt=0, reftag=0)
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-01-26 18:21:37 +08:00
|
|
|
#endif /* _TRACE_NVME_H */
|
|
|
|
|
|
|
|
#undef TRACE_INCLUDE_PATH
|
|
|
|
#define TRACE_INCLUDE_PATH .
|
|
|
|
#undef TRACE_INCLUDE_FILE
|
|
|
|
#define TRACE_INCLUDE_FILE trace
|
|
|
|
|
|
|
|
/* This part must be outside protection */
|
|
|
|
#include <trace/define_trace.h>
|