Skip to contentSkip to conversation

nvme: fix async event trace event

PATCH Applied Keith Busch 6 participants 6 messages Apr 5, 2023 – Apr 11, 2023 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: fix async event trace event

From: Keith Busch <[email protected]>

Mixing AER Event Type and Event Info has masking clashes. Just print the event type, but also include the event info of the AER result in the trace.

Fixes 09bd1ff4b15143b ("nvme-core: add async event trace helper")
Cc Chaitanya Kulkarni <[email protected]>
---
 drivers/nvme/host/core.c  |  5 +----
 drivers/nvme/host/trace.h | 15 ++++++---------
 2 files changed, 7 insertions(+), 13 deletions(-)
drivers/nvme/host/core.c +1 -4
index d6a9bac91a4cd..bdf1601219fc4 100644
@@ -4819,8 +4819,6 @@ static bool nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
 	u32 aer_notice_type = nvme_aer_subtype(result);
 	bool requeue = true;
 
-	trace_nvme_async_event(ctrl, aer_notice_type);
-
 	switch (aer_notice_type) {
 	case NVME_AER_NOTICE_NS_CHANGED:
 		set_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events);
@@ -4856,7 +4854,6 @@ static bool nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
 
 static void nvme_handle_aer_persistent_error(struct nvme_ctrl *ctrl)
 {
-	trace_nvme_async_event(ctrl, NVME_AER_ERROR);
 	dev_warn(ctrl->device, "resetting controller due to AER\n");
 	nvme_reset_ctrl(ctrl);
 }
@@ -4872,6 +4869,7 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
 	if (le16_to_cpu(status) >> 1 != NVME_SC_SUCCESS)
 		return;
 
+	trace_nvme_async_event(ctrl, result);
 	switch (aer_type) {
 	case NVME_AER_NOTICE:
 		requeue = nvme_handle_aen_notice(ctrl, result);
@@ -4889,7 +4887,6 @@ 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, aer_type);
 		ctrl->aen_result = result;
 		break;
 	default:
drivers/nvme/host/trace.h +6 -9
index 6f0eaf6a15282..4fb5922ffdac5 100644
@@ -127,15 +127,12 @@ TRACE_EVENT(nvme_async_event,
 	),
 	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),
-		aer_name(NVME_AER_NOTICE_DISC_CHANGED),
-		aer_name(NVME_AER_ERROR),
-		aer_name(NVME_AER_SMART),
-		aer_name(NVME_AER_CSS),
-		aer_name(NVME_AER_VS))
+		__print_symbolic(__entry->result & 0x7,
+			aer_name(NVME_AER_ERROR),
+			aer_name(NVME_AER_SMART),
+			aer_name(NVME_AER_NOTICE),
+			aer_name(NVME_AER_CSS),
+			aer_name(NVME_AER_VS))
 	)
 );
 
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 1 line · Keith Busch

Well, no idea if this is a real email address, though it's a copy-paste from the "From" in the original report. Getting this error:

The mail system

<[email protected]>: host mailin.samsung.com[203.254.224.12] said: 550
5.1.1 Recipient address rejected: User unknown (in reply to RCPT TO command)

Regardless, patch should be fine.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Keith Busch
Quoted 10 lines · Keith Busch

From: Keith Busch <[email protected]>

Mixing AER Event Type and Event Info has masking clashes. Just print the event type, but also include the event info of the AER result in the trace.

Fixes 09bd1ff4b15143b ("nvme-core: add async event trace helper")
Cc Chaitanya Kulkarni <[email protected]>
Reviewed-by on v1 1/1
#3 lore raw
In reply to Keith Busch
Quoted 11 lines · Keith Busch

From: Keith Busch <[email protected]>

Mixing AER Event Type and Event Info has masking clashes. Just print the event type, but also include the event info of the AER result in the trace.

Fixes 09bd1ff4b15143b ("nvme-core: add async event trace helper")
Cc Chaitanya Kulkarni <[email protected]>

---

thanks for fixing this, looks good.

-ck