Trace point definitions are reporting different linux devices for the
same CXL hardware device. Clean this up. Add additional parent device
and serial number to all the trace points for easier user space
identification.
Signed-off-by: Ira Weiny <[email protected]>
---
Changes in v2:
- Dan: Add patch for serial number
- Fix macro parameter isolation
- Minor formatting change
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Ira Weiny (3):
cxl/trace: Standardize device information output
cxl/trace: Add host output to trace points
cxl/trace: Add serial number to trace points
drivers/cxl/core/mbox.c | 14 +++----
drivers/cxl/core/pci.c | 8 +---
drivers/cxl/core/trace.h | 95 +++++++++++++++++++++++++++++-------------------
3 files changed, 66 insertions(+), 51 deletions(-)
---
base-commit: b8b9ffced017528bcdd262730ab10bc5084c3bb4
change-id: 20230208-cxl-event-names-9372fb72a607
Best regards,
--
Ira Weiny <[email protected]>
The host parameter of where the memdev is connected is useful
information.
Report host consistently in all trace points.
Cc: Steven Rostedt <[email protected]>
Cc: Dave Jiang <[email protected]>
Signed-off-by: Ira Weiny <[email protected]>
---
Changes for v2
Correctly use parens in the CXL_EVT_TP_fast_assign macro
---
drivers/cxl/core/trace.h | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
index 93ac651a2f21..ed69e558187b 100644
--- a/drivers/cxl/core/trace.h
+++ b/drivers/cxl/core/trace.h
@@ -51,12 +51,14 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
TP_ARGS(cxlmd, status, fe, hl),
TP_STRUCT__entry(
__string(memdev, dev_name(&cxlmd->dev))
+ __string(host, dev_name(cxlmd->dev.parent))
__field(u32, status)
__field(u32, first_error)
__array(u32, header_log, CXL_HEADERLOG_SIZE_U32)
),
TP_fast_assign(
__assign_str(memdev, dev_name(&cxlmd->dev));
+ __assign_str(host, dev_name(cxlmd->dev.parent));
__entry->status = status;
__entry->first_error = fe;
/*
@@ -65,8 +67,8 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
*/
memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE);
),
- TP_printk("memdev=%s: status: '%s' first_error: '%s'",
- __get_str(memdev),
+ TP_printk("memdev=%s host=%s: status: '%s' first_error: '%s'",
+ __get_str(memdev), __get_str(host),
show_uc_errs(__entry->status),
show_uc_errs(__entry->first_error)
)
@@ -95,14 +97,17 @@ TRACE_EVENT(cxl_aer_correctable_error,
TP_ARGS(cxlmd, status),
TP_STRUCT__entry(
__string(memdev, dev_name(&cxlmd->dev))
+ __string(host, dev_name(cxlmd->dev.parent))
__field(u32, status)
),
TP_fast_assign(
__assign_str(memdev, dev_name(&cxlmd->dev));
+ __assign_str(host, dev_name(cxlmd->dev.parent));
__entry->status = status;
),
- TP_printk("memdev=%s: status: '%s'",
- __get_str(memdev), show_ce_errs(__entry->status)
+ TP_printk("memdev=%s host=%s: status: '%s'",
+ __get_str(memdev), __get_str(host),
+ show_ce_errs(__entry->status)
)
);
@@ -122,6 +127,7 @@ TRACE_EVENT(cxl_overflow,
TP_STRUCT__entry(
__string(memdev, dev_name(&cxlmd->dev))
+ __string(host, dev_name(cxlmd->dev.parent))
__field(int, log)
__field(u64, first_ts)
__field(u64, last_ts)
@@ -130,15 +136,17 @@ TRACE_EVENT(cxl_overflow,
TP_fast_assign(
__assign_str(memdev, dev_name(&cxlmd->dev));
+ __assign_str(host, dev_name(cxlmd->dev.parent));
__entry->log = log;
__entry->count = le16_to_cpu(payload->overflow_err_count);
__entry->first_ts = le64_to_cpu(payload->first_overflow_timestamp);
__entry->last_ts = le64_to_cpu(payload->last_overflow_timestamp);
),
- TP_printk("memdev=%s: log=%s : %u records from %llu to %llu",
- __get_str(memdev), cxl_event_log_type_str(__entry->log),
- __entry->count, __entry->first_ts, __entry->last_ts)
+ TP_printk("memdev=%s host=%s: log=%s : %u records from %llu to %llu",
+ __get_str(memdev), __get_str(host),
+ cxl_event_log_type_str(__entry->log), __entry->count,
+ __entry->first_ts, __entry->last_ts)
);
@@ -171,6 +179,7 @@ TRACE_EVENT(cxl_overflow,
*/
#define CXL_EVT_TP_entry \
__string(memdev, dev_name(&cxlmd->dev)) \
+ __string(host, dev_name(cxlmd->dev.parent)) \
__field(int, log) \
__field_struct(uuid_t, hdr_uuid) \
__field(u32, hdr_flags) \
@@ -182,6 +191,7 @@ TRACE_EVENT(cxl_overflow,
#define CXL_EVT_TP_fast_assign(cxlmd, l, hdr) \
__assign_str(memdev, dev_name(&(cxlmd)->dev)); \
+ __assign_str(host, dev_name((cxlmd)->dev.parent)); \
__entry->log = (l); \
memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \
__entry->hdr_length = (hdr).length; \
@@ -192,10 +202,11 @@ TRACE_EVENT(cxl_overflow,
__entry->hdr_maint_op_class = (hdr).maint_op_class
#define CXL_EVT_TP_printk(fmt, ...) \
- TP_printk("memdev=%s log=%s : time=%llu uuid=%pUb len=%d flags='%s' " \
- "handle=%x related_handle=%x maint_op_class=%u" \
+ TP_printk("memdev=%s host=%s log=%s : time=%llu uuid=%pUb len=%d " \
+ "flags='%s' handle=%x related_handle=%x maint_op_class=%u" \
" : " fmt, \
- __get_str(memdev), cxl_event_log_type_str(__entry->log), \
+ __get_str(memdev), __get_str(host), \
+ cxl_event_log_type_str(__entry->log), \
__entry->hdr_timestamp, &__entry->hdr_uuid, __entry->hdr_length,\
show_hdr_flags(__entry->hdr_flags), __entry->hdr_handle, \
__entry->hdr_related_handle, __entry->hdr_maint_op_class, \
--
2.39.1
Device serial numbers are useful information for the user.
Add device serial numbers to all the trace points.
Cc: Steven Rostedt <[email protected]>
Cc: Dave Jiang <[email protected]>
Signed-off-by: Ira Weiny <[email protected]>
---
NOTE: Device serial numbers default to 0 but can be added in QEMU with
the following syntax for testing:
"-device cxl-type3,sn=<serial>,..."
Changes for v2
From Dan
New patch -- don't forget the serial number
---
drivers/cxl/core/trace.h | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
index ed69e558187b..9b8d3d997834 100644
--- a/drivers/cxl/core/trace.h
+++ b/drivers/cxl/core/trace.h
@@ -52,6 +52,7 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
TP_STRUCT__entry(
__string(memdev, dev_name(&cxlmd->dev))
__string(host, dev_name(cxlmd->dev.parent))
+ __field(u64, serial)
__field(u32, status)
__field(u32, first_error)
__array(u32, header_log, CXL_HEADERLOG_SIZE_U32)
@@ -59,6 +60,7 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
TP_fast_assign(
__assign_str(memdev, dev_name(&cxlmd->dev));
__assign_str(host, dev_name(cxlmd->dev.parent));
+ __entry->serial = cxlmd->cxlds->serial;
__entry->status = status;
__entry->first_error = fe;
/*
@@ -67,8 +69,8 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
*/
memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE);
),
- TP_printk("memdev=%s host=%s: status: '%s' first_error: '%s'",
- __get_str(memdev), __get_str(host),
+ TP_printk("memdev=%s host=%s serial=%lld: status: '%s' first_error: '%s'",
+ __get_str(memdev), __get_str(host), __entry->serial,
show_uc_errs(__entry->status),
show_uc_errs(__entry->first_error)
)
@@ -98,15 +100,17 @@ TRACE_EVENT(cxl_aer_correctable_error,
TP_STRUCT__entry(
__string(memdev, dev_name(&cxlmd->dev))
__string(host, dev_name(cxlmd->dev.parent))
+ __field(u64, serial)
__field(u32, status)
),
TP_fast_assign(
__assign_str(memdev, dev_name(&cxlmd->dev));
__assign_str(host, dev_name(cxlmd->dev.parent));
+ __entry->serial = cxlmd->cxlds->serial;
__entry->status = status;
),
- TP_printk("memdev=%s host=%s: status: '%s'",
- __get_str(memdev), __get_str(host),
+ TP_printk("memdev=%s host=%s serial=%lld: status: '%s'",
+ __get_str(memdev), __get_str(host), __entry->serial,
show_ce_errs(__entry->status)
)
);
@@ -129,6 +133,7 @@ TRACE_EVENT(cxl_overflow,
__string(memdev, dev_name(&cxlmd->dev))
__string(host, dev_name(cxlmd->dev.parent))
__field(int, log)
+ __field(u64, serial)
__field(u64, first_ts)
__field(u64, last_ts)
__field(u16, count)
@@ -137,14 +142,15 @@ TRACE_EVENT(cxl_overflow,
TP_fast_assign(
__assign_str(memdev, dev_name(&cxlmd->dev));
__assign_str(host, dev_name(cxlmd->dev.parent));
+ __entry->serial = cxlmd->cxlds->serial;
__entry->log = log;
__entry->count = le16_to_cpu(payload->overflow_err_count);
__entry->first_ts = le64_to_cpu(payload->first_overflow_timestamp);
__entry->last_ts = le64_to_cpu(payload->last_overflow_timestamp);
),
- TP_printk("memdev=%s host=%s: log=%s : %u records from %llu to %llu",
- __get_str(memdev), __get_str(host),
+ TP_printk("memdev=%s host=%s serial=%lld: log=%s : %u records from %llu to %llu",
+ __get_str(memdev), __get_str(host), __entry->serial,
cxl_event_log_type_str(__entry->log), __entry->count,
__entry->first_ts, __entry->last_ts)
@@ -182,6 +188,7 @@ TRACE_EVENT(cxl_overflow,
__string(host, dev_name(cxlmd->dev.parent)) \
__field(int, log) \
__field_struct(uuid_t, hdr_uuid) \
+ __field(u64, serial) \
__field(u32, hdr_flags) \
__field(u16, hdr_handle) \
__field(u16, hdr_related_handle) \
@@ -193,6 +200,7 @@ TRACE_EVENT(cxl_overflow,
__assign_str(memdev, dev_name(&(cxlmd)->dev)); \
__assign_str(host, dev_name((cxlmd)->dev.parent)); \
__entry->log = (l); \
+ __entry->serial = (cxlmd)->cxlds->serial; \
memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \
__entry->hdr_length = (hdr).length; \
__entry->hdr_flags = get_unaligned_le24((hdr).flags); \
@@ -202,10 +210,10 @@ TRACE_EVENT(cxl_overflow,
__entry->hdr_maint_op_class = (hdr).maint_op_class
#define CXL_EVT_TP_printk(fmt, ...) \
- TP_printk("memdev=%s host=%s log=%s : time=%llu uuid=%pUb len=%d " \
- "flags='%s' handle=%x related_handle=%x maint_op_class=%u" \
- " : " fmt, \
- __get_str(memdev), __get_str(host), \
+ TP_printk("memdev=%s host=%s serial=%lld log=%s : time=%llu uuid=%pUb " \
+ "len=%d flags='%s' handle=%x related_handle=%x " \
+ "maint_op_class=%u : " fmt, \
+ __get_str(memdev), __get_str(host), __entry->serial, \
cxl_event_log_type_str(__entry->log), \
__entry->hdr_timestamp, &__entry->hdr_uuid, __entry->hdr_length,\
show_hdr_flags(__entry->hdr_flags), __entry->hdr_handle, \
--
2.39.1
Ira Weiny wrote:
> Trace point definitions are reporting different linux devices for the
> same CXL hardware device. Clean this up. Add additional parent device
> and serial number to all the trace points for easier user space
> identification.
>
> Signed-off-by: Ira Weiny <[email protected]>
> ---
> Changes in v2:
> - Dan: Add patch for serial number
> - Fix macro parameter isolation
> - Minor formatting change
> - Link to v1: https://lore.kernel.org/r/[email protected]
>
> ---
> Ira Weiny (3):
> cxl/trace: Standardize device information output
> cxl/trace: Add host output to trace points
> cxl/trace: Add serial number to trace points
>
> drivers/cxl/core/mbox.c | 14 +++----
> drivers/cxl/core/pci.c | 8 +---
> drivers/cxl/core/trace.h | 95 +++++++++++++++++++++++++++++-------------------
> 3 files changed, 66 insertions(+), 51 deletions(-)
> ---
> base-commit: b8b9ffced017528bcdd262730ab10bc5084c3bb4
> change-id: 20230208-cxl-event-names-9372fb72a607
>
> Best regards,
> --
> Ira Weiny <[email protected]>
>
Looks good, applied.