mbox series

[v2,0/4] CXL Poison List Retrieval & Tracing

Message ID cover.1665606782.git.alison.schofield@intel.com
Headers show
Series CXL Poison List Retrieval & Tracing | expand

Message

Alison Schofield Oct. 12, 2022, 9:28 p.m. UTC
From: Alison Schofield <alison.schofield@intel.com>

Adds support for retrieving device poison lists and
store the returned error records as kernel trace events.

The handling of the poison list is guided by the CXL 3.0 Spec
Section 8.2.9.8.4.1. [1] 

Example command line usage:

Triggered by memdev:
$ echo 1 > /sys/bus/cxl/devices/mem1/trigger_poison_list

cxl_poison:           pid:981 region: memdev:mem1 pcidev:cxl_mem.1 hpa:0x0 dpa:0xc0 length:0xc0 source:Internal flags: overflow_time:0
cxl_poison:           pid:981 region: memdev:mem1 pcidev:cxl_mem.1 hpa:0x0 dpa:0x180 length:0x100 source:Injected flags: overflow_time:0

Triggered by region: (region name is included in the trace)
$ echo 1 > /sys/bus/cxl/devices/region5/trigger_poison_list

cxl_poison:           pid:1132 region:region5 memdev:mem2 pcidev:cxl_mem.2 hpa:0x0 dpa:0x0 length:0x40 source:Unknown flags: overflow_time:0
cxl_poison:           pid:1132 region:region5 memdev:mem2 pcidev:cxl_mem.2 hpa:0x0 dpa:0x40 length:0x80 source:External flags: overflow_time:0

Changes v1->v2
- Added per region poison collection 
- Protect poison list w mutex
- Replace range usage w resource
- S/poison_max_mer/poison_max in cxl_dev_state kdoc (Ira)
- Renamed sysfs attribute to 'trigger_poison_list'
- _store() rm chatty dev_err() msgs (Jonathan, Dan)
- _store() use kstrtobool (Jonathan, Dan)
- _store() simplify return (Jonathan)
- cxl_memdev_visible() skip local vars on way enabled_cmds (Jonathan)
- cxl_memdev_visible() use kobj_to_dev() helper (Dan)
- Misc name shortenings and cleanups.
- Replace goto w break in cxl_mem_get_poison() do-while loop.
- Don't error out on FLAGS, record in trace event.
- Add kernel CXL_POISON__LIST_MAX (64) and guard against exceeding (Dan)
- Add current->pid to trace  (Dan)
- Return the poison length as multiple of 64 per spec (Jonathan)
- Mask starting address from record->address (Jonathan)
- Move range selection to sysfs_store and make cxl_mem_get_poison() accept it.
- Get both the volatile & persistent ranges per memdev.
- Add pci device name to trace (Dan)

[1]: https://www.computeexpresslink.org/download-the-specification

Alison Schofield (4):
  trace, cxl: Introduce a TRACE_EVENT for CXL poison records
  cxl/mbox: Add GET_POISON_LIST mailbox command
  cxl/memdev: Add trigger_poison_list sysfs attribute
  cxl/region: Add trigger_poison_list sysfs attribute

 Documentation/ABI/testing/sysfs-bus-cxl | 28 ++++++++
 drivers/cxl/core/mbox.c                 | 69 +++++++++++++++++++
 drivers/cxl/core/memdev.c               | 41 ++++++++++++
 drivers/cxl/core/region.c               | 34 ++++++++++
 drivers/cxl/cxlmem.h                    | 42 ++++++++++++
 include/trace/events/cxl.h              | 88 +++++++++++++++++++++++++
 6 files changed, 302 insertions(+)
 create mode 100644 include/trace/events/cxl.h


base-commit: 1985cf58850562e4b960e19d46f0d8f19d6c7cbd