From: Alison Schofield <alison.schofi...@intel.com> Changes since v10: - Use offset, length notation in json output (Dan) - Remove endpoint decoder from json output - Man page updates to reflect above changes - Remove open coded tep_find_field() (Dan) - Use raw instead of custom string helper - Use get_field_val() in u8,32,64 helpers instead of _raw (Dan) - Pass event_ctx to its own parsing method as a typical 'this' pointer (Dan) - Replace private_ctx w poison_ctx in event_ctx. This addresses Dan's feedback to avoid a void* but stops short of his suggestion to wrap event_ctx in a private_ctx for this single use case. - v10: https://lore.kernel.org/linux-cxl/cover.1709748564.git.alison.schofi...@intel.com/
Begin cover letter: Add the option to add a memory devices poison list to the cxl-list json output. Offer the option by memdev and by region. >From the man page cxl-list: -L, --media-errors Include media-error information. The poison list is retrieved from the device(s) and media_error records are added to the listing. Apply this option to memdevs and regions where devices support the poison list capability. "offset:" is relative to the region resource when listing by region and is the absolute device DPA when listing by memdev. "source:" is one of: External, Internal, Injected, Vendor Specific, or Unknown, as defined in CXL Specification v3.1 Table 8-140. # cxl list -m mem9 --media-errors -u { "memdev":"mem9", "pmem_size":"1024.00 MiB (1073.74 MB)", "pmem_qos_class":42, "ram_size":"1024.00 MiB (1073.74 MB)", "ram_qos_class":42, "serial":"0x5", "numa_node":1, "host":"cxl_mem.5", "media_errors":[ { "offset":"0x40000000", "length":64, "source":"Injected" } ] } In the above example, region mappings can be found using: "cxl list -p mem9 --decoders" # cxl list -r region5 --media-errors -u { "region":"region5", "resource":"0xf110000000", "size":"2.00 GiB (2.15 GB)", "type":"pmem", "interleave_ways":2, "interleave_granularity":4096, "decode_state":"commit", "media_errors":[ { "offset":"0x1000", "length":64, "source":"Injected" }, { "offset":"0x2000", "length":64, "source":"Injected" } ] } In the above example, memdev mappings can be found using: "cxl list -r region5 --targets" and "cxl list -d <decoder_name>" Alison Schofield (7): libcxl: add interfaces for GET_POISON_LIST mailbox commands cxl/event_trace: add an optional pid check to event parsing cxl/event_trace: support poison context in event parsing cxl/event_trace: add helpers to retrieve tep fields by type cxl/list: collect and parse media_error records cxl/list: add --media-errors option to cxl list cxl/test: add cxl-poison.sh unit test Documentation/cxl/cxl-list.txt | 62 ++++++++++- cxl/event_trace.c | 51 ++++++++- cxl/event_trace.h | 19 +++- cxl/filter.h | 3 + cxl/json.c | 194 +++++++++++++++++++++++++++++++++ cxl/lib/libcxl.c | 47 ++++++++ cxl/lib/libcxl.sym | 2 + cxl/libcxl.h | 2 + cxl/list.c | 3 + test/cxl-poison.sh | 137 +++++++++++++++++++++++ test/meson.build | 2 + 11 files changed, 514 insertions(+), 8 deletions(-) create mode 100644 test/cxl-poison.sh base-commit: e0d0680bd3e554bd5f211e989480c5a13a023b2d -- 2.37.3