Merge branch 'for-6.3/cxl-events' into cxl/next

Include some additional fixups for event support for v6.3, namely,
rationalize the identifiers in the trace output and fixup a kdoc
comment.
This commit is contained in:
Dan Williams 2023-02-16 15:27:12 -08:00
commit 23c198e3df
4 changed files with 67 additions and 51 deletions

View File

@ -768,7 +768,7 @@ static const uuid_t mem_mod_event_uuid =
UUID_INIT(0xfe927475, 0xdd59, 0x4339, UUID_INIT(0xfe927475, 0xdd59, 0x4339,
0xa5, 0x86, 0x79, 0xba, 0xb1, 0x13, 0xb7, 0x74); 0xa5, 0x86, 0x79, 0xba, 0xb1, 0x13, 0xb7, 0x74);
static void cxl_event_trace_record(const struct device *dev, static void cxl_event_trace_record(const struct cxl_memdev *cxlmd,
enum cxl_event_log_type type, enum cxl_event_log_type type,
struct cxl_event_record_raw *record) struct cxl_event_record_raw *record)
{ {
@ -778,19 +778,19 @@ static void cxl_event_trace_record(const struct device *dev,
struct cxl_event_gen_media *rec = struct cxl_event_gen_media *rec =
(struct cxl_event_gen_media *)record; (struct cxl_event_gen_media *)record;
trace_cxl_general_media(dev, type, rec); trace_cxl_general_media(cxlmd, type, rec);
} else if (uuid_equal(id, &dram_event_uuid)) { } else if (uuid_equal(id, &dram_event_uuid)) {
struct cxl_event_dram *rec = (struct cxl_event_dram *)record; struct cxl_event_dram *rec = (struct cxl_event_dram *)record;
trace_cxl_dram(dev, type, rec); trace_cxl_dram(cxlmd, type, rec);
} else if (uuid_equal(id, &mem_mod_event_uuid)) { } else if (uuid_equal(id, &mem_mod_event_uuid)) {
struct cxl_event_mem_module *rec = struct cxl_event_mem_module *rec =
(struct cxl_event_mem_module *)record; (struct cxl_event_mem_module *)record;
trace_cxl_memory_module(dev, type, rec); trace_cxl_memory_module(cxlmd, type, rec);
} else { } else {
/* For unknown record types print just the header */ /* For unknown record types print just the header */
trace_cxl_generic_event(dev, type, record); trace_cxl_generic_event(cxlmd, type, record);
} }
} }
@ -897,11 +897,11 @@ static void cxl_mem_get_records_log(struct cxl_dev_state *cxlds,
break; break;
for (i = 0; i < nr_rec; i++) for (i = 0; i < nr_rec; i++)
cxl_event_trace_record(cxlds->dev, type, cxl_event_trace_record(cxlds->cxlmd, type,
&payload->records[i]); &payload->records[i]);
if (payload->flags & CXL_GET_EVENT_FLAG_OVERFLOW) if (payload->flags & CXL_GET_EVENT_FLAG_OVERFLOW)
trace_cxl_overflow(cxlds->dev, type, payload); trace_cxl_overflow(cxlds->cxlmd, type, payload);
rc = cxl_clear_event_record(cxlds, type, payload); rc = cxl_clear_event_record(cxlds, type, payload);
if (rc) { if (rc) {

View File

@ -608,8 +608,6 @@ EXPORT_SYMBOL_NS_GPL(read_cdat_data, CXL);
void cxl_cor_error_detected(struct pci_dev *pdev) void cxl_cor_error_detected(struct pci_dev *pdev)
{ {
struct cxl_dev_state *cxlds = pci_get_drvdata(pdev); struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);
struct cxl_memdev *cxlmd = cxlds->cxlmd;
struct device *dev = &cxlmd->dev;
void __iomem *addr; void __iomem *addr;
u32 status; u32 status;
@ -620,7 +618,7 @@ void cxl_cor_error_detected(struct pci_dev *pdev)
status = readl(addr); status = readl(addr);
if (status & CXL_RAS_CORRECTABLE_STATUS_MASK) { if (status & CXL_RAS_CORRECTABLE_STATUS_MASK) {
writel(status & CXL_RAS_CORRECTABLE_STATUS_MASK, addr); writel(status & CXL_RAS_CORRECTABLE_STATUS_MASK, addr);
trace_cxl_aer_correctable_error(dev, status); trace_cxl_aer_correctable_error(cxlds->cxlmd, status);
} }
} }
EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, CXL); EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, CXL);
@ -648,8 +646,6 @@ static void header_log_copy(struct cxl_dev_state *cxlds, u32 *log)
*/ */
static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) static bool cxl_report_and_clear(struct cxl_dev_state *cxlds)
{ {
struct cxl_memdev *cxlmd = cxlds->cxlmd;
struct device *dev = &cxlmd->dev;
u32 hl[CXL_HEADERLOG_SIZE_U32]; u32 hl[CXL_HEADERLOG_SIZE_U32];
void __iomem *addr; void __iomem *addr;
u32 status; u32 status;
@ -675,7 +671,7 @@ static bool cxl_report_and_clear(struct cxl_dev_state *cxlds)
} }
header_log_copy(cxlds, hl); header_log_copy(cxlds, hl);
trace_cxl_aer_uncorrectable_error(dev, status, fe, hl); trace_cxl_aer_uncorrectable_error(cxlds->cxlmd, status, fe, hl);
writel(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK, addr); writel(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK, addr);
return true; return true;

View File

@ -47,16 +47,20 @@
) )
TRACE_EVENT(cxl_aer_uncorrectable_error, TRACE_EVENT(cxl_aer_uncorrectable_error,
TP_PROTO(const struct device *dev, u32 status, u32 fe, u32 *hl), TP_PROTO(const struct cxl_memdev *cxlmd, u32 status, u32 fe, u32 *hl),
TP_ARGS(dev, status, fe, hl), TP_ARGS(cxlmd, status, fe, hl),
TP_STRUCT__entry( TP_STRUCT__entry(
__string(dev_name, dev_name(dev)) __string(memdev, dev_name(&cxlmd->dev))
__string(host, dev_name(cxlmd->dev.parent))
__field(u64, serial)
__field(u32, status) __field(u32, status)
__field(u32, first_error) __field(u32, first_error)
__array(u32, header_log, CXL_HEADERLOG_SIZE_U32) __array(u32, header_log, CXL_HEADERLOG_SIZE_U32)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(dev_name, dev_name(dev)); __assign_str(memdev, dev_name(&cxlmd->dev));
__assign_str(host, dev_name(cxlmd->dev.parent));
__entry->serial = cxlmd->cxlds->serial;
__entry->status = status; __entry->status = status;
__entry->first_error = fe; __entry->first_error = fe;
/* /*
@ -65,8 +69,8 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
*/ */
memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE); memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE);
), ),
TP_printk("%s: status: '%s' first_error: '%s'", TP_printk("memdev=%s host=%s serial=%lld: status: '%s' first_error: '%s'",
__get_str(dev_name), __get_str(memdev), __get_str(host), __entry->serial,
show_uc_errs(__entry->status), show_uc_errs(__entry->status),
show_uc_errs(__entry->first_error) show_uc_errs(__entry->first_error)
) )
@ -91,18 +95,23 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
) )
TRACE_EVENT(cxl_aer_correctable_error, TRACE_EVENT(cxl_aer_correctable_error,
TP_PROTO(const struct device *dev, u32 status), TP_PROTO(const struct cxl_memdev *cxlmd, u32 status),
TP_ARGS(dev, status), TP_ARGS(cxlmd, status),
TP_STRUCT__entry( TP_STRUCT__entry(
__string(dev_name, dev_name(dev)) __string(memdev, dev_name(&cxlmd->dev))
__string(host, dev_name(cxlmd->dev.parent))
__field(u64, serial)
__field(u32, status) __field(u32, status)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(dev_name, dev_name(dev)); __assign_str(memdev, dev_name(&cxlmd->dev));
__assign_str(host, dev_name(cxlmd->dev.parent));
__entry->serial = cxlmd->cxlds->serial;
__entry->status = status; __entry->status = status;
), ),
TP_printk("%s: status: '%s'", TP_printk("memdev=%s host=%s serial=%lld: status: '%s'",
__get_str(dev_name), show_ce_errs(__entry->status) __get_str(memdev), __get_str(host), __entry->serial,
show_ce_errs(__entry->status)
) )
); );
@ -115,30 +124,35 @@ TRACE_EVENT(cxl_aer_correctable_error,
TRACE_EVENT(cxl_overflow, TRACE_EVENT(cxl_overflow,
TP_PROTO(const struct device *dev, enum cxl_event_log_type log, TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
struct cxl_get_event_payload *payload), struct cxl_get_event_payload *payload),
TP_ARGS(dev, log, payload), TP_ARGS(cxlmd, log, payload),
TP_STRUCT__entry( TP_STRUCT__entry(
__string(dev_name, dev_name(dev)) __string(memdev, dev_name(&cxlmd->dev))
__string(host, dev_name(cxlmd->dev.parent))
__field(int, log) __field(int, log)
__field(u64, serial)
__field(u64, first_ts) __field(u64, first_ts)
__field(u64, last_ts) __field(u64, last_ts)
__field(u16, count) __field(u16, count)
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(dev_name, dev_name(dev)); __assign_str(memdev, dev_name(&cxlmd->dev));
__assign_str(host, dev_name(cxlmd->dev.parent));
__entry->serial = cxlmd->cxlds->serial;
__entry->log = log; __entry->log = log;
__entry->count = le16_to_cpu(payload->overflow_err_count); __entry->count = le16_to_cpu(payload->overflow_err_count);
__entry->first_ts = le64_to_cpu(payload->first_overflow_timestamp); __entry->first_ts = le64_to_cpu(payload->first_overflow_timestamp);
__entry->last_ts = le64_to_cpu(payload->last_overflow_timestamp); __entry->last_ts = le64_to_cpu(payload->last_overflow_timestamp);
), ),
TP_printk("%s: log=%s : %u records from %llu to %llu", TP_printk("memdev=%s host=%s serial=%lld: log=%s : %u records from %llu to %llu",
__get_str(dev_name), cxl_event_log_type_str(__entry->log), __get_str(memdev), __get_str(host), __entry->serial,
__entry->count, __entry->first_ts, __entry->last_ts) cxl_event_log_type_str(__entry->log), __entry->count,
__entry->first_ts, __entry->last_ts)
); );
@ -170,9 +184,11 @@ TRACE_EVENT(cxl_overflow,
* See the generic_event tracepoint as an example. * See the generic_event tracepoint as an example.
*/ */
#define CXL_EVT_TP_entry \ #define CXL_EVT_TP_entry \
__string(dev_name, dev_name(dev)) \ __string(memdev, dev_name(&cxlmd->dev)) \
__string(host, dev_name(cxlmd->dev.parent)) \
__field(int, log) \ __field(int, log) \
__field_struct(uuid_t, hdr_uuid) \ __field_struct(uuid_t, hdr_uuid) \
__field(u64, serial) \
__field(u32, hdr_flags) \ __field(u32, hdr_flags) \
__field(u16, hdr_handle) \ __field(u16, hdr_handle) \
__field(u16, hdr_related_handle) \ __field(u16, hdr_related_handle) \
@ -180,9 +196,11 @@ TRACE_EVENT(cxl_overflow,
__field(u8, hdr_length) \ __field(u8, hdr_length) \
__field(u8, hdr_maint_op_class) __field(u8, hdr_maint_op_class)
#define CXL_EVT_TP_fast_assign(dev, l, hdr) \ #define CXL_EVT_TP_fast_assign(cxlmd, l, hdr) \
__assign_str(dev_name, dev_name(dev)); \ __assign_str(memdev, dev_name(&(cxlmd)->dev)); \
__assign_str(host, dev_name((cxlmd)->dev.parent)); \
__entry->log = (l); \ __entry->log = (l); \
__entry->serial = (cxlmd)->cxlds->serial; \
memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \ memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \
__entry->hdr_length = (hdr).length; \ __entry->hdr_length = (hdr).length; \
__entry->hdr_flags = get_unaligned_le24((hdr).flags); \ __entry->hdr_flags = get_unaligned_le24((hdr).flags); \
@ -192,10 +210,11 @@ TRACE_EVENT(cxl_overflow,
__entry->hdr_maint_op_class = (hdr).maint_op_class __entry->hdr_maint_op_class = (hdr).maint_op_class
#define CXL_EVT_TP_printk(fmt, ...) \ #define CXL_EVT_TP_printk(fmt, ...) \
TP_printk("%s log=%s : time=%llu uuid=%pUb len=%d flags='%s' " \ TP_printk("memdev=%s host=%s serial=%lld log=%s : time=%llu uuid=%pUb " \
"handle=%x related_handle=%x maint_op_class=%u" \ "len=%d flags='%s' handle=%x related_handle=%x " \
" : " fmt, \ "maint_op_class=%u : " fmt, \
__get_str(dev_name), cxl_event_log_type_str(__entry->log), \ __get_str(memdev), __get_str(host), __entry->serial, \
cxl_event_log_type_str(__entry->log), \
__entry->hdr_timestamp, &__entry->hdr_uuid, __entry->hdr_length,\ __entry->hdr_timestamp, &__entry->hdr_uuid, __entry->hdr_length,\
show_hdr_flags(__entry->hdr_flags), __entry->hdr_handle, \ show_hdr_flags(__entry->hdr_flags), __entry->hdr_handle, \
__entry->hdr_related_handle, __entry->hdr_maint_op_class, \ __entry->hdr_related_handle, __entry->hdr_maint_op_class, \
@ -203,10 +222,10 @@ TRACE_EVENT(cxl_overflow,
TRACE_EVENT(cxl_generic_event, TRACE_EVENT(cxl_generic_event,
TP_PROTO(const struct device *dev, enum cxl_event_log_type log, TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
struct cxl_event_record_raw *rec), struct cxl_event_record_raw *rec),
TP_ARGS(dev, log, rec), TP_ARGS(cxlmd, log, rec),
TP_STRUCT__entry( TP_STRUCT__entry(
CXL_EVT_TP_entry CXL_EVT_TP_entry
@ -214,7 +233,7 @@ TRACE_EVENT(cxl_generic_event,
), ),
TP_fast_assign( TP_fast_assign(
CXL_EVT_TP_fast_assign(dev, log, rec->hdr); CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
memcpy(__entry->data, &rec->data, CXL_EVENT_RECORD_DATA_LENGTH); memcpy(__entry->data, &rec->data, CXL_EVENT_RECORD_DATA_LENGTH);
), ),
@ -293,10 +312,10 @@ TRACE_EVENT(cxl_generic_event,
TRACE_EVENT(cxl_general_media, TRACE_EVENT(cxl_general_media,
TP_PROTO(const struct device *dev, enum cxl_event_log_type log, TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
struct cxl_event_gen_media *rec), struct cxl_event_gen_media *rec),
TP_ARGS(dev, log, rec), TP_ARGS(cxlmd, log, rec),
TP_STRUCT__entry( TP_STRUCT__entry(
CXL_EVT_TP_entry CXL_EVT_TP_entry
@ -315,7 +334,7 @@ TRACE_EVENT(cxl_general_media,
), ),
TP_fast_assign( TP_fast_assign(
CXL_EVT_TP_fast_assign(dev, log, rec->hdr); CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
/* General Media */ /* General Media */
__entry->dpa = le64_to_cpu(rec->phys_addr); __entry->dpa = le64_to_cpu(rec->phys_addr);
@ -376,10 +395,10 @@ TRACE_EVENT(cxl_general_media,
TRACE_EVENT(cxl_dram, TRACE_EVENT(cxl_dram,
TP_PROTO(const struct device *dev, enum cxl_event_log_type log, TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
struct cxl_event_dram *rec), struct cxl_event_dram *rec),
TP_ARGS(dev, log, rec), TP_ARGS(cxlmd, log, rec),
TP_STRUCT__entry( TP_STRUCT__entry(
CXL_EVT_TP_entry CXL_EVT_TP_entry
@ -401,7 +420,7 @@ TRACE_EVENT(cxl_dram,
), ),
TP_fast_assign( TP_fast_assign(
CXL_EVT_TP_fast_assign(dev, log, rec->hdr); CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
/* DRAM */ /* DRAM */
__entry->dpa = le64_to_cpu(rec->phys_addr); __entry->dpa = le64_to_cpu(rec->phys_addr);
@ -525,10 +544,10 @@ TRACE_EVENT(cxl_dram,
TRACE_EVENT(cxl_memory_module, TRACE_EVENT(cxl_memory_module,
TP_PROTO(const struct device *dev, enum cxl_event_log_type log, TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
struct cxl_event_mem_module *rec), struct cxl_event_mem_module *rec),
TP_ARGS(dev, log, rec), TP_ARGS(cxlmd, log, rec),
TP_STRUCT__entry( TP_STRUCT__entry(
CXL_EVT_TP_entry CXL_EVT_TP_entry
@ -548,7 +567,7 @@ TRACE_EVENT(cxl_memory_module,
), ),
TP_fast_assign( TP_fast_assign(
CXL_EVT_TP_fast_assign(dev, log, rec->hdr); CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
/* Memory Module Event */ /* Memory Module Event */
__entry->event_type = rec->event_type; __entry->event_type = rec->event_type;

View File

@ -250,6 +250,7 @@ struct cxl_event_state {
* @info: Cached DVSEC information about the device. * @info: Cached DVSEC information about the device.
* @serial: PCIe Device Serial Number * @serial: PCIe Device Serial Number
* @doe_mbs: PCI DOE mailbox array * @doe_mbs: PCI DOE mailbox array
* @event: event log driver state
* @mbox_send: @dev specific transport for transmitting mailbox commands * @mbox_send: @dev specific transport for transmitting mailbox commands
* *
* See section 8.2.9.5.2 Capacity Configuration and Label Storage for * See section 8.2.9.5.2 Capacity Configuration and Label Storage for