Skip to content

Commit 6d0fc41

Browse files
weiny2djbw
authored andcommitted
cxl/trace: Pass UUID explicitly to event traces
CXL CPER events are identified by the CPER Section Type GUID. The GUID correlates with the CXL UUID for the event record. It turns out that a CXL CPER record is a strict subset of the CXL event record, only the UUID header field is chopped. In order to unify handling between native and CPER flavors of CXL events, prepare the code for the UUID to be passed in rather than inferred from the record itself. Later patches update the passed in record to only refer to the common data between the formats. Pass the UUID explicitly to each trace event to be able to remove the UUID from the event structures. Originally it was desirable to remove the UUID from the well known event because the UUID value was redundant. However, the trace API was already in place.[1] Signed-off-by: Ira Weiny <ira.weiny@intel.com> Link: https://lore.kernel.org/all/36f2d12934d64a278f2c0313cbd01abc@huawei.com [1] Link: https://lore.kernel.org/r/20231220-cxl-cper-v5-1-1bb8a4ca2c7a@intel.com Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 861deac commit 6d0fc41

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

drivers/cxl/core/mbox.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -870,19 +870,19 @@ static void cxl_event_trace_record(const struct cxl_memdev *cxlmd,
870870
struct cxl_event_gen_media *rec =
871871
(struct cxl_event_gen_media *)record;
872872

873-
trace_cxl_general_media(cxlmd, type, rec);
873+
trace_cxl_general_media(cxlmd, type, id, rec);
874874
} else if (uuid_equal(id, &dram_event_uuid)) {
875875
struct cxl_event_dram *rec = (struct cxl_event_dram *)record;
876876

877-
trace_cxl_dram(cxlmd, type, rec);
877+
trace_cxl_dram(cxlmd, type, id, rec);
878878
} else if (uuid_equal(id, &mem_mod_event_uuid)) {
879879
struct cxl_event_mem_module *rec =
880880
(struct cxl_event_mem_module *)record;
881881

882-
trace_cxl_memory_module(cxlmd, type, rec);
882+
trace_cxl_memory_module(cxlmd, type, id, rec);
883883
} else {
884884
/* For unknown record types print just the header */
885-
trace_cxl_generic_event(cxlmd, type, record);
885+
trace_cxl_generic_event(cxlmd, type, id, record);
886886
}
887887
}
888888

drivers/cxl/core/trace.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ TRACE_EVENT(cxl_overflow,
198198
__field(u8, hdr_length) \
199199
__field(u8, hdr_maint_op_class)
200200

201-
#define CXL_EVT_TP_fast_assign(cxlmd, l, hdr) \
201+
#define CXL_EVT_TP_fast_assign(cxlmd, l, uuid, hdr) \
202202
__assign_str(memdev, dev_name(&(cxlmd)->dev)); \
203203
__assign_str(host, dev_name((cxlmd)->dev.parent)); \
204204
__entry->log = (l); \
205205
__entry->serial = (cxlmd)->cxlds->serial; \
206-
memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \
206+
memcpy(&__entry->hdr_uuid, (uuid), sizeof(uuid_t)); \
207207
__entry->hdr_length = (hdr).length; \
208208
__entry->hdr_flags = get_unaligned_le24((hdr).flags); \
209209
__entry->hdr_handle = le16_to_cpu((hdr).handle); \
@@ -225,17 +225,17 @@ TRACE_EVENT(cxl_overflow,
225225
TRACE_EVENT(cxl_generic_event,
226226

227227
TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
228-
struct cxl_event_record_raw *rec),
228+
const uuid_t *uuid, struct cxl_event_record_raw *rec),
229229

230-
TP_ARGS(cxlmd, log, rec),
230+
TP_ARGS(cxlmd, log, uuid, rec),
231231

232232
TP_STRUCT__entry(
233233
CXL_EVT_TP_entry
234234
__array(u8, data, CXL_EVENT_RECORD_DATA_LENGTH)
235235
),
236236

237237
TP_fast_assign(
238-
CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
238+
CXL_EVT_TP_fast_assign(cxlmd, log, uuid, rec->hdr);
239239
memcpy(__entry->data, &rec->data, CXL_EVENT_RECORD_DATA_LENGTH);
240240
),
241241

@@ -315,9 +315,9 @@ TRACE_EVENT(cxl_generic_event,
315315
TRACE_EVENT(cxl_general_media,
316316

317317
TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
318-
struct cxl_event_gen_media *rec),
318+
const uuid_t *uuid, struct cxl_event_gen_media *rec),
319319

320-
TP_ARGS(cxlmd, log, rec),
320+
TP_ARGS(cxlmd, log, uuid, rec),
321321

322322
TP_STRUCT__entry(
323323
CXL_EVT_TP_entry
@@ -336,7 +336,7 @@ TRACE_EVENT(cxl_general_media,
336336
),
337337

338338
TP_fast_assign(
339-
CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
339+
CXL_EVT_TP_fast_assign(cxlmd, log, uuid, rec->hdr);
340340

341341
/* General Media */
342342
__entry->dpa = le64_to_cpu(rec->phys_addr);
@@ -398,9 +398,9 @@ TRACE_EVENT(cxl_general_media,
398398
TRACE_EVENT(cxl_dram,
399399

400400
TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
401-
struct cxl_event_dram *rec),
401+
const uuid_t *uuid, struct cxl_event_dram *rec),
402402

403-
TP_ARGS(cxlmd, log, rec),
403+
TP_ARGS(cxlmd, log, uuid, rec),
404404

405405
TP_STRUCT__entry(
406406
CXL_EVT_TP_entry
@@ -422,7 +422,7 @@ TRACE_EVENT(cxl_dram,
422422
),
423423

424424
TP_fast_assign(
425-
CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
425+
CXL_EVT_TP_fast_assign(cxlmd, log, uuid, rec->hdr);
426426

427427
/* DRAM */
428428
__entry->dpa = le64_to_cpu(rec->phys_addr);
@@ -547,9 +547,9 @@ TRACE_EVENT(cxl_dram,
547547
TRACE_EVENT(cxl_memory_module,
548548

549549
TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log,
550-
struct cxl_event_mem_module *rec),
550+
const uuid_t *uuid, struct cxl_event_mem_module *rec),
551551

552-
TP_ARGS(cxlmd, log, rec),
552+
TP_ARGS(cxlmd, log, uuid, rec),
553553

554554
TP_STRUCT__entry(
555555
CXL_EVT_TP_entry
@@ -569,7 +569,7 @@ TRACE_EVENT(cxl_memory_module,
569569
),
570570

571571
TP_fast_assign(
572-
CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr);
572+
CXL_EVT_TP_fast_assign(cxlmd, log, uuid, rec->hdr);
573573

574574
/* Memory Module Event */
575575
__entry->event_type = rec->event_type;

0 commit comments

Comments
 (0)