Skip to contentSkip to conversation

nvme-core: add async event trace helper

PATCH Superseded Chaitanya Kulkarni 2 participants 3 messages Aug 29, 2018 NVMe

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-core: add async event trace helper

This patch adds a new event for nvme async event notification. We print the async event in the decoded format when we recognize the event otherwise we just dump the result.

This tracing event is needed to observe/log the different NVMe Asynchronous Event from different types of controllers NVMe PCIe or NVMeOF.

Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 drivers/nvme/host/core.c  |  5 +++++
 drivers/nvme/host/trace.h | 16 ++++++++++++++++
 2 files changed, 21 insertions(+)
drivers/nvme/host/core.c +5 -0
index dd8ec1dd9219..92ec8f946ec7 100644
@@ -3413,14 +3413,17 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
 {
 	switch ((result & 0xff00) >> 8) {
 	case NVME_AER_NOTICE_NS_CHANGED:
+		trace_nvme_async_event(ctrl, NVME_AER_NOTICE_NS_CHANGED);
 		set_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events);
 		nvme_queue_scan(ctrl);
 		break;
 	case NVME_AER_NOTICE_FW_ACT_STARTING:
+		trace_nvme_async_event(ctrl, NVME_AER_NOTICE_FW_ACT_STARTING);
 		queue_work(nvme_wq, &ctrl->fw_act_work);
 		break;
 #ifdef CONFIG_NVME_MULTIPATH
 	case NVME_AER_NOTICE_ANA:
+		trace_nvme_async_event(ctrl, NVME_AER_NOTICE_ANA);
 		if (!ctrl->ana_log_buf)
 			break;
 		queue_work(nvme_wq, &ctrl->ana_work);
@@ -3447,9 +3450,11 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
 	case NVME_AER_SMART:
 	case NVME_AER_CSS:
 	case NVME_AER_VS:
+		trace_nvme_async_event(ctrl, result & 0x7);
 		ctrl->aen_result = result;
 		break;
 	default:
+		trace_nvme_async_event(ctrl, result);
 		break;
 	}
 	queue_work(nvme_wq, &ctrl->async_event_work);
drivers/nvme/host/trace.h +16 -0
index a490790d6691..4db3b71db801 100644
@@ -156,6 +156,22 @@ TRACE_EVENT(nvme_complete_rq,
 
 );
 
+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",
+			__entry->ctrl_id, __entry->result)
+
+	   );
+
 #endif /* _TRACE_NVME_H */
 
 #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/1 nvme-core: add async event trace helper

Quoted 8 lines · Chaitanya Kulkarni

This patch adds a new event for nvme async event notification. We print the async event in the decoded format when we recognize the event otherwise we just dump the result.

This tracing event is needed to observe/log the different NVMe Asynchronous Event from different types of controllers NVMe PCIe or NVMeOF.

[...]

Quoted 6 lines
drivers/nvme/host/trace.h +6 -0
+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)

drivers/nvme/host/trace.h TRACE_EVENT(nvme_complete_rq, · line 174

Quoted 10 lines
drivers/nvme/host/trace.h +10 -0
+			),
+		TP_fast_assign(
+			__entry->ctrl_id = ctrl->instance;
+			__entry->result = result;
+			),
+		TP_printk("nvme%d: NVME_AEN=%#08x",
+			__entry->ctrl_id, __entry->result)
+
+	   );
+

Cool thanks, but can you add maybe also print a __stringify()ed version of the AEN? So we get "nvme0: NVME_AEN_CFG_ANA_CHANGE" instead of "nvme0: NVME_AEN=0x00000800".

Signature · 6 lines
Johannes Thumshirn                                          Storage
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
#2 lore raw

PATCH 1/1 nvme-core: add async event trace helper

Done.

From: Johannes Thumshirn <[email protected]>
Sent: Wednesday, August 29, 2018 1:34 AM
To: Chaitanya Kulkarni
Cc: linux-nvme at lists.infradead.org
Subject: Re: [PATCH] nvme-core: add async event trace helper ?

Quoted 8 lines · Chaitanya Kulkarni

This patch adds a new event for nvme async event notification. We print the async event in the decoded format when we recognize the event otherwise we just dump the result.

This tracing event is needed to observe/log the different NVMe Asynchronous Event from different types of controllers NVMe PCIe or NVMeOF.

[...]

Quoted 6 lines
(quoted diff) +6 -0
+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)

Review

Quoted 10 lines
(quoted diff) +10 -0
+???????????????????? ),
+???????????? TP_fast_assign(
+???????????????????? __entry->ctrl_id = ctrl->instance;
+???????????????????? __entry->result = result;
+???????????????????? ),
+???????????? TP_printk("nvme%d: NVME_AEN=%#08x",
+???????????????????? __entry->ctrl_id, __entry->result)
+
+??????? );
+

Cool thanks, but can you add maybe also print a __stringify()ed version of the AEN? So we get "nvme0: NVME_AEN_CFG_ANA_CHANGE" instead of "nvme0: NVME_AEN=0x00000800".

Signature · 6 lines
Johannes Thumshirn????????????????????????????????????????? Storage
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