Skip to content

Commit 84b377e

Browse files
committed
cxl/mem: Trace Dynamic capacity Event Record
CXL rev 3.1 section 8.2.9.2.1 adds the Dynamic Capacity Event Records. User space can use trace events for debugging of DC capacity changes. Add DC trace points to the trace log. Based on an original patch by Navneet Singh. Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Fan Ni <[email protected]> Signed-off-by: Ira Weiny <[email protected]> --- Changes: [djbw: s/region/partition/] [iweiny: s/tag/uuid/]
1 parent ee2d72b commit 84b377e

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

drivers/cxl/core/mbox.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,10 @@ static void __cxl_event_trace_record(const struct cxl_memdev *cxlmd,
10431043
ev_type = CXL_CPER_EVENT_DRAM;
10441044
else if (uuid_equal(uuid, &CXL_EVENT_MEM_MODULE_UUID))
10451045
ev_type = CXL_CPER_EVENT_MEM_MODULE;
1046+
else if (uuid_equal(uuid, &CXL_EVENT_DC_EVENT_UUID)) {
1047+
trace_cxl_dynamic_capacity(cxlmd, type, &record->event.dcd);
1048+
return;
1049+
}
10461050

10471051
cxl_event_trace_record(cxlmd, type, ev_type, uuid, &record->event);
10481052
}

drivers/cxl/core/trace.h

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,71 @@ TRACE_EVENT(cxl_poison,
978978
)
979979
);
980980

981+
/*
982+
* Dynamic Capacity Event Record - DER
983+
*
984+
* CXL rev 3.1 section 8.2.9.2.1.6 Table 8-50
985+
*/
986+
987+
#define CXL_DC_ADD_CAPACITY 0x00
988+
#define CXL_DC_REL_CAPACITY 0x01
989+
#define CXL_DC_FORCED_REL_CAPACITY 0x02
990+
#define CXL_DC_REG_CONF_UPDATED 0x03
991+
#define show_dc_evt_type(type) __print_symbolic(type, \
992+
{ CXL_DC_ADD_CAPACITY, "Add capacity"}, \
993+
{ CXL_DC_REL_CAPACITY, "Release capacity"}, \
994+
{ CXL_DC_FORCED_REL_CAPACITY, "Forced capacity release"}, \
995+
{ CXL_DC_REG_CONF_UPDATED, "Region Configuration Updated" } \
996+
)
997+
998+
TRACE_EVENT(cxl_dynamic_capacity,
999+
1000+
TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
1001+
struct cxl_event_dcd *rec),
1002+
1003+
TP_ARGS(cxlmd, log, rec),
1004+
1005+
TP_STRUCT__entry(
1006+
CXL_EVT_TP_entry
1007+
1008+
/* Dynamic capacity Event */
1009+
__field(u8, event_type)
1010+
__field(u16, hostid)
1011+
__field(u8, partition_id)
1012+
__field(u64, dpa_start)
1013+
__field(u64, length)
1014+
__array(u8, uuid, UUID_SIZE)
1015+
__field(u16, sh_extent_seq)
1016+
),
1017+
1018+
TP_fast_assign(
1019+
CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
1020+
1021+
/* Dynamic_capacity Event */
1022+
__entry->event_type = rec->event_type;
1023+
1024+
/* DCD event record data */
1025+
__entry->hostid = le16_to_cpu(rec->host_id);
1026+
__entry->partition_id = rec->partition_index;
1027+
__entry->dpa_start = le64_to_cpu(rec->extent.start_dpa);
1028+
__entry->length = le64_to_cpu(rec->extent.length);
1029+
memcpy(__entry->uuid, &rec->extent.uuid, UUID_SIZE);
1030+
__entry->sh_extent_seq = le16_to_cpu(rec->extent.shared_extn_seq);
1031+
),
1032+
1033+
CXL_EVT_TP_printk("event_type='%s' host_id='%d' partition_id='%d' " \
1034+
"starting_dpa=%llx length=%llx tag=%pU " \
1035+
"shared_extent_sequence=%d",
1036+
show_dc_evt_type(__entry->event_type),
1037+
__entry->hostid,
1038+
__entry->partition_id,
1039+
__entry->dpa_start,
1040+
__entry->length,
1041+
__entry->uuid,
1042+
__entry->sh_extent_seq
1043+
)
1044+
);
1045+
9811046
#endif /* _CXL_EVENTS_H */
9821047

9831048
#define TRACE_INCLUDE_FILE trace

0 commit comments

Comments
 (0)