Skip to contentSkip to conversation

cxl/events: Fix Trace DRAM Event Record

PATCH In review [email protected] 2 participants 3 messages Oct 14, 2024 CXL

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxl/events: Fix Trace DRAM Event Record

From: Shiju Jose <[email protected]>

CXL spec rev 3.0 section 8.2.9.2.1.2 defines the DRAM Event Record.

Fix decode memory event type field of DRAM Event Record.
For e.g. if value is 0x1 it will be reported as an Invalid Address (General Media Event Record - Memory Event Type) instead of Scrub Media ECC Error (DRAM Event Record - Memory Event Type) and so on.

Fixes 2d6c1e6d60ba ("cxl/mem: Trace DRAM Event Record")

---
Updates for event records in CXL spec r3.1 will follow shortly.

 drivers/cxl/core/trace.h | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/cxl/core/trace.h +14 -3
index 9167cfba7f59..cdffebcf20a4 100644
@@ -279,7 +279,7 @@ TRACE_EVENT(cxl_generic_event,
 #define CXL_GMER_MEM_EVT_TYPE_ECC_ERROR			0x00
 #define CXL_GMER_MEM_EVT_TYPE_INV_ADDR			0x01
 #define CXL_GMER_MEM_EVT_TYPE_DATA_PATH_ERROR		0x02
-#define show_mem_event_type(type)	__print_symbolic(type,			\
+#define show_gmer_mem_event_type(type)	__print_symbolic(type,			\
 	{ CXL_GMER_MEM_EVT_TYPE_ECC_ERROR,		"ECC Error" },		\
 	{ CXL_GMER_MEM_EVT_TYPE_INV_ADDR,		"Invalid Address" },	\
 	{ CXL_GMER_MEM_EVT_TYPE_DATA_PATH_ERROR,	"Data Path Error" }	\
@@ -373,7 +373,7 @@ TRACE_EVENT(cxl_general_media,
 		"hpa=%llx region=%s region_uuid=%pUb",
 		__entry->dpa, show_dpa_flags(__entry->dpa_flags),
 		show_event_desc_flags(__entry->descriptor),
-		show_mem_event_type(__entry->type),
+		show_gmer_mem_event_type(__entry->type),
 		show_trans_type(__entry->transaction_type),
 		__entry->channel, __entry->rank, __entry->device,
 		__print_hex(__entry->comp_id, CXL_EVENT_GEN_MED_COMP_ID_SIZE),
@@ -391,6 +391,17 @@ TRACE_EVENT(cxl_general_media,
  * DRAM Event Record defines many fields the same as the General Media Event
  * Record.  Reuse those definitions as appropriate.
  */
+#define CXL_DER_MEM_EVT_TYPE_ECC_ERROR			0x00
+#define CXL_DER_MEM_EVT_TYPE_SCRUB_MEDIA_ECC_ERROR	0x01
+#define CXL_DER_MEM_EVT_TYPE_INV_ADDR			0x02
+#define CXL_DER_MEM_EVT_TYPE_DATA_PATH_ERROR		0x03
+#define show_dram_mem_event_type(type)  __print_symbolic(type,				\
+	{ CXL_DER_MEM_EVT_TYPE_ECC_ERROR,		"ECC Error" },			\
+	{ CXL_DER_MEM_EVT_TYPE_SCRUB_MEDIA_ECC_ERROR,	"Scrub Media ECC Error" },	\
+	{ CXL_DER_MEM_EVT_TYPE_INV_ADDR,		"Invalid Address" },		\
+	{ CXL_DER_MEM_EVT_TYPE_DATA_PATH_ERROR,		"Data Path Error" }		\
+)
+
 #define CXL_DER_VALID_CHANNEL				BIT(0)
 #define CXL_DER_VALID_RANK				BIT(1)
 #define CXL_DER_VALID_NIBBLE				BIT(2)
@@ -477,7 +488,7 @@ TRACE_EVENT(cxl_dram,
 		"hpa=%llx region=%s region_uuid=%pUb",
 		__entry->dpa, show_dpa_flags(__entry->dpa_flags),
 		show_event_desc_flags(__entry->descriptor),
-		show_mem_event_type(__entry->type),
+		show_dram_mem_event_type(__entry->type),
 		show_trans_type(__entry->transaction_type),
 		__entry->channel, __entry->rank, __entry->nibble_mask,
 		__entry->bank_group, __entry->bank,
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · shiju.jose@ wrote:

From: Shiju Jose <[email protected]>

CXL spec rev 3.0 section 8.2.9.2.1.2 defines the DRAM Event Record.

Fix decode memory event type field of DRAM Event Record.
For e.g. if value is 0x1 it will be reported as an Invalid Address (General Media Event Record - Memory Event Type) instead of Scrub Media ECC Error (DRAM Event Record - Memory Event Type) and so on.

Fixes 2d6c1e6d60ba ("cxl/mem: Trace DRAM Event Record")

I assume this is causing issues with user space?

If so I will add...

Cc <[email protected]> # 6.3.x

... and queue this up in cxl-fixes.

Quoted 59 lines

---
Updates for event records in CXL spec r3.1 will follow shortly.

 drivers/cxl/core/trace.h | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/cxl/core/trace.h +14 -3
index 9167cfba7f59..cdffebcf20a4 100644
@@ -279,7 +279,7 @@ TRACE_EVENT(cxl_generic_event,
 #define CXL_GMER_MEM_EVT_TYPE_ECC_ERROR			0x00
 #define CXL_GMER_MEM_EVT_TYPE_INV_ADDR			0x01
 #define CXL_GMER_MEM_EVT_TYPE_DATA_PATH_ERROR		0x02
-#define show_mem_event_type(type)	__print_symbolic(type,			\
+#define show_gmer_mem_event_type(type)	__print_symbolic(type,			\
 	{ CXL_GMER_MEM_EVT_TYPE_ECC_ERROR,		"ECC Error" },		\
 	{ CXL_GMER_MEM_EVT_TYPE_INV_ADDR,		"Invalid Address" },	\
 	{ CXL_GMER_MEM_EVT_TYPE_DATA_PATH_ERROR,	"Data Path Error" }	\
@@ -373,7 +373,7 @@ TRACE_EVENT(cxl_general_media,
 		"hpa=%llx region=%s region_uuid=%pUb",
 		__entry->dpa, show_dpa_flags(__entry->dpa_flags),
 		show_event_desc_flags(__entry->descriptor),
-		show_mem_event_type(__entry->type),
+		show_gmer_mem_event_type(__entry->type),
 		show_trans_type(__entry->transaction_type),
 		__entry->channel, __entry->rank, __entry->device,
 		__print_hex(__entry->comp_id, CXL_EVENT_GEN_MED_COMP_ID_SIZE),
@@ -391,6 +391,17 @@ TRACE_EVENT(cxl_general_media,
  * DRAM Event Record defines many fields the same as the General Media Event
  * Record.  Reuse those definitions as appropriate.
  */
+#define CXL_DER_MEM_EVT_TYPE_ECC_ERROR			0x00
+#define CXL_DER_MEM_EVT_TYPE_SCRUB_MEDIA_ECC_ERROR	0x01
+#define CXL_DER_MEM_EVT_TYPE_INV_ADDR			0x02
+#define CXL_DER_MEM_EVT_TYPE_DATA_PATH_ERROR		0x03
+#define show_dram_mem_event_type(type)  __print_symbolic(type,				\
+	{ CXL_DER_MEM_EVT_TYPE_ECC_ERROR,		"ECC Error" },			\
+	{ CXL_DER_MEM_EVT_TYPE_SCRUB_MEDIA_ECC_ERROR,	"Scrub Media ECC Error" },	\
+	{ CXL_DER_MEM_EVT_TYPE_INV_ADDR,		"Invalid Address" },		\
+	{ CXL_DER_MEM_EVT_TYPE_DATA_PATH_ERROR,		"Data Path Error" }		\
+)
+
 #define CXL_DER_VALID_CHANNEL				BIT(0)
 #define CXL_DER_VALID_RANK				BIT(1)
 #define CXL_DER_VALID_NIBBLE				BIT(2)
@@ -477,7 +488,7 @@ TRACE_EVENT(cxl_dram,
 		"hpa=%llx region=%s region_uuid=%pUb",
 		__entry->dpa, show_dpa_flags(__entry->dpa_flags),
 		show_event_desc_flags(__entry->descriptor),
-		show_mem_event_type(__entry->type),
+		show_dram_mem_event_type(__entry->type),
 		show_trans_type(__entry->transaction_type),
 		__entry->channel, __entry->rank, __entry->nibble_mask,
 		__entry->bank_group, __entry->bank,
Signature · 1 line
2.34.1
author
#2 lore raw
Quoted 17 lines

-----Original Message-----
From: Ira Weiny <[email protected]>
Sent: 14 October 2024 15:51
To: Shiju Jose <[email protected]>; [email protected]; [email protected]; Jonathan Cameron <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Cc: Linuxarm <[email protected]>; tanxiaofei <[email protected]>; Zengtao (B) <[email protected]>; Shiju Jose <[email protected]>
Subject: Re: [PATCH 1/1] cxl/events: Fix Trace DRAM Event Record

Quoted 4 lines · shiju.jose@ wrote:

From: Shiju Jose <[email protected]>

CXL spec rev 3.0 section 8.2.9.2.1.2 defines the DRAM Event Record.

Quoted 8 lines
Quoted 6 lines

Fix decode memory event type field of DRAM Event Record. For e.g. if value is 0x1 it will be reported as an Invalid Address (General Media Event Record - Memory Event Type) instead of Scrub Media ECC Error (DRAM Event Record - Memory Event Type) and so on.

Fixes 2d6c1e6d60ba ("cxl/mem: Trace DRAM Event Record")

I assume this is causing issues with user space?

This change directly affects kernel logging for memory event type in DRAM event record only. However similar fix is needed in rasdaemon too because I referred the kernel code for the CXL event logging part in the user space.

Quoted 72 lines

If so I will add...

Cc <[email protected]> # 6.3.x

... and queue this up in cxl-fixes.

Quoted 12 lines

---
Updates for event records in CXL spec r3.1 will follow shortly.

 drivers/cxl/core/trace.h | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/cxl/core/trace.h index renamed from drivers/cxl/core/trace.h +0 -0

9167cfba7f59..cdffebcf20a4 100644

drivers/cxl/core/trace.h TRACE_EVENT(cxl_generic_event, · line 282

Quoted 4 lines
drivers/cxl/core/trace.h +0 -1
@@ -279,7 +279,7 @@ TRACE_EVENT(cxl_generic_event,
 #define CXL_GMER_MEM_EVT_TYPE_ECC_ERROR			0x00
 #define CXL_GMER_MEM_EVT_TYPE_INV_ADDR			0x01
 #define CXL_GMER_MEM_EVT_TYPE_DATA_PATH_ERROR		0x02
-#define show_mem_event_type(type)	__print_symbolic(type,
	\

drivers/cxl/core/trace.h TRACE_EVENT(cxl_generic_event, · line 282

Quoted 1 line
drivers/cxl/core/trace.h +1 -0
+#define show_gmer_mem_event_type(type)	__print_symbolic(type,
		\

drivers/cxl/core/trace.h TRACE_EVENT(cxl_generic_event, · line 283

Quoted 1 line
drivers/cxl/core/trace.h +0 -0
 	{ CXL_GMER_MEM_EVT_TYPE_ECC_ERROR,		"ECC Error" },
		\

drivers/cxl/core/trace.h TRACE_EVENT(cxl_generic_event, · line 284

Quoted 1 line
drivers/cxl/core/trace.h +0 -0
 	{ CXL_GMER_MEM_EVT_TYPE_INV_ADDR,		"Invalid

Address" }, \

drivers/cxl/core/trace.h TRACE_EVENT(cxl_generic_event, · line 285

Quoted 1 line
drivers/cxl/core/trace.h +0 -0
 	{ CXL_GMER_MEM_EVT_TYPE_DATA_PATH_ERROR,	"Data Path

Error" } \

drivers/cxl/core/trace.h TRACE_EVENT(cxl_general_media, · line 379

Quoted 9 lines
drivers/cxl/core/trace.h +1 -1
@@ -373,7 +373,7 @@ TRACE_EVENT(cxl_general_media,
 		"hpa=%llx region=%s region_uuid=%pUb",
 		__entry->dpa, show_dpa_flags(__entry->dpa_flags),
 		show_event_desc_flags(__entry->descriptor),
-		show_mem_event_type(__entry->type),
+		show_gmer_mem_event_type(__entry->type),
 		show_trans_type(__entry->transaction_type),
 		__entry->channel, __entry->rank, __entry->device,
 		__print_hex(__entry->comp_id,

CXL_EVENT_GEN_MED_COMP_ID_SIZE), @@

Quoted 2 lines

-391,6 +391,17 @@ TRACE_EVENT(cxl_general_media,
* DRAM Event Record defines many fields the same as the General Media

Event

drivers/cxl/core/trace.h TRACE_EVENT(cxl_general_media,

Quoted 7 lines

* Record. Reuse those definitions as appropriate. */

drivers/cxl/core/trace.h +5 -0
+#define CXL_DER_MEM_EVT_TYPE_ECC_ERROR			0x00
+#define CXL_DER_MEM_EVT_TYPE_SCRUB_MEDIA_ECC_ERROR	0x01
+#define CXL_DER_MEM_EVT_TYPE_INV_ADDR			0x02
+#define CXL_DER_MEM_EVT_TYPE_DATA_PATH_ERROR		0x03
+#define show_dram_mem_event_type(type)  __print_symbolic(type,
			\

drivers/cxl/core/trace.h

Quoted 1 line
drivers/cxl/core/trace.h +1 -0
+	{ CXL_DER_MEM_EVT_TYPE_ECC_ERROR,		"ECC Error" },
			\

drivers/cxl/core/trace.h

Quoted 1 line
drivers/cxl/core/trace.h +1 -0
+	{ CXL_DER_MEM_EVT_TYPE_SCRUB_MEDIA_ECC_ERROR,	"Scrub

Media ECC Error" }, \

drivers/cxl/core/trace.h

Quoted 1 line
drivers/cxl/core/trace.h +1 -0
+	{ CXL_DER_MEM_EVT_TYPE_INV_ADDR,		"Invalid

Address" }, \

drivers/cxl/core/trace.h

Quoted 1 line
drivers/cxl/core/trace.h +1 -0
+	{ CXL_DER_MEM_EVT_TYPE_DATA_PATH_ERROR,		"Data

Path Error" } \

Quoted 9 lines
drivers/cxl/core/trace.h +2 -0
+)
+
 #define CXL_DER_VALID_CHANNEL				BIT(0)
 #define CXL_DER_VALID_RANK				BIT(1)
 #define CXL_DER_VALID_NIBBLE				BIT(2)
@@ -477,7 +488,7 @@ TRACE_EVENT(cxl_dram,
 		"hpa=%llx region=%s region_uuid=%pUb",
 		__entry->dpa, show_dpa_flags(__entry->dpa_flags),
 		show_event_desc_flags(__entry->descriptor),
Quoted 10 lines
Quoted 8 lines
drivers/cxl/core/trace.h +1 -2
-		show_mem_event_type(__entry->type),
+		show_dram_mem_event_type(__entry->type),
 		show_trans_type(__entry->transaction_type),
 		__entry->channel, __entry->rank, __entry->nibble_mask,
 		__entry->bank_group, __entry->bank,
--

2.34.1

Thanks,
Shiju