[v3,0/6] CXL Poison List Retrieval & Tracing

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

Message

Alison Schofield Nov. 11, 2022, 3:12 a.m. UTC
  From: Alison Schofield <alison.schofield@intel.com>

Add 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 Specification
Section 8.2.9.8.4.1. [1] 

Example, triggered by memdev:
$ echo 1 > /sys/bus/cxl/devices/mem3/trigger_poison_list
cxl_poison: memdev=mem3 pcidev=cxl_mem.3 region= region_uuid=00000000-0000-0000-0000-000000000000 dpa=0x0 length=0x40 source=Internal flags= overflow_time=0

Example, triggered by region:
$ echo 1 > /sys/bus/cxl/devices/region5/trigger_poison_list
cxl_poison: memdev=mem0 pcidev=cxl_mem.0 region=region5 region_uuid=bfcb7a29-890e-4a41-8236-fe22221fc75c dpa=0x0 length=0x40 source=Internal flags= overflow_time=0
cxl_poison: memdev=mem1 pcidev=cxl_mem.1 region=region5 region_uuid=bfcb7a29-890e-4a41-8236-fe22221fc75c dpa=0x0 length=0x40 source=Internal flags= overflow_time=0

Changes in v3:
- Rebase to 6.1-rc4
- Rebase picked up cxl_dpa_resource_start() (Jonathan)
- Move poison source defines to cxlmem.h from events/cxl.h
- TRACE_printk helper macros display 'Reserved' for illegal poison sources
  rather than failing to parse.
- Add region uuid to the trace event.
- Always get poison, but only parse records if tracing is enabled.(Steve)
  There was a little foresight on not moving the calcs to the event
  definition itself, as Steve also suggested. The DPA->HPA translation
  is coming, and that work seems better kept in the driver itself.
- Remove unused hpa trace field. Add back when hpa is available.
- Remove pid from cxl_poison event. Find in common event field. (Steve)
- cxl_test: Add mock support for get poison

Changes in 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 (6):
  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
  tools/testing/cxl: Mock the max err records field of Identify cmd
  tools/testing/cxl: Mock the Get Poison List mbox command

 Documentation/ABI/testing/sysfs-bus-cxl | 28 +++++++++
 drivers/cxl/core/mbox.c                 | 81 +++++++++++++++++++++++++
 drivers/cxl/core/memdev.c               | 41 +++++++++++++
 drivers/cxl/core/region.c               | 33 ++++++++++
 drivers/cxl/cxlmem.h                    | 51 ++++++++++++++++
 include/trace/events/cxl.h              | 80 ++++++++++++++++++++++++
 tools/testing/cxl/test/mem.c            | 35 +++++++++++
 7 files changed, 349 insertions(+)
 create mode 100644 include/trace/events/cxl.h


base-commit: f0c4d9fc9cc9462659728d168387191387e903cc