Skip to content

platform/x86/intel/pmt: Notify userspace when crashlogs complete

David E. Box intel-xe lkml platform-driver-x86 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest1 patch 1 replyIn review

Changes in v2 from the cover letter

- Replaced the two uevent variables with a single INTEL_PMT_CRASHLOG_COMPLETE. INTEL_PMT_CRASHLOG_EVENT=PRESENT and COMPLETE=1 were both fixed and carried no information beyond the event itself.
- Emit COMPLETE=0 when a manual trigger does not complete within the poll window, so userspace is not left waiting.
- Reject manual triggers until probe has finished setting up the entry. This closes a window where a trigger during intel_pmt_dev_create() could queue work against a device freed by its error path (reported by sashiko on v1).
- Dropped the cancel_*_sync() calls on the intel_pmt_dev_create() failure and skip paths. They ran after the device was already freed, but with triggers now rejected until setup completes no work can be pending there.
- End the trigger poll without an event when the log is cleared or rearmed while it is running.
- Cancel a stale poll only after the new trigger has been written, so a failed trigger leaves the previous poll in place.
- Run the probe-time check under control_mutex, in the same critical section that enables triggers.
- Run the poll on the freezable workqueue so it does not read the device during suspend.
- Rebased onto review-ilpo-next and adapted to the crashlog register helpers now returning errors (Michal's additions). A failed status read counts as not complete.
- Rewrote the ABI

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1platform/x86/intel/pmt: Notify userspace when crashlogs completeDocumentation/ABI/testing/sysfs-class-intel_pmt drivers/platform/x86/intel/pmt/crashlog.c+165 -51 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/1] platform/x86/intel/pmt: Notify userspace when crashlogs complete

This patch adds a uevent so userspace can find out when an Intel PMT crashlog is available without polling.

It emits a KOBJ_CHANGE uevent on the crashlog<x> device carrying INTEL_PMT_CRASHLOG_COMPLETE. The value is 1 when a completed crashlog is found at probe, or when a manually triggered capture completes. The value is 0 when a manual trigger does not complete within the 5 second poll window. The ABI documentation is updated to match.

v1 was a three-patch series. Patches 1 and 2 are no longer part of it:

- Patch 1 (NULL dereference when reading crashlog data) is dropped in favor of Michael's "platform/x86/intel/pmt: complete pcidev to device update" (b86e5062cb88), which fixes the same bug.

- Patch 2 (inverted walk_header() test in get_features()) has been applied as 3678e39c6aae.

Both are in the base of this posting, review-ilpo-next. The patch also applies cleanly to for-next.

Testing: the patch was tested in an emulated (QEMU) environment on a kernel with CONFIG_PROVE_LOCKING, covering the probe-time event, the event after a manual trigger completes, triggers rejected while a log is complete or the device is disabled, clear, trigger=0 and rearm while the trigger poll is running, expiry of the poll window, module removal with the poll pending, and re-probe. Hardware with this crashlog support is available, but testing on it is still pending.

V2 changes:
- Replaced the two uevent variables with a single INTEL_PMT_CRASHLOG_COMPLETE. INTEL_PMT_CRASHLOG_EVENT=PRESENT and COMPLETE=1 were both fixed and carried no information beyond the event itself.
- Emit COMPLETE=0 when a manual trigger does not complete within the poll window, so userspace is not left waiting.
- Reject manual triggers until probe has finished setting up the entry. This closes a window where a trigger during intel_pmt_dev_create() could queue work against a device freed by its error path (reported by sashiko on v1).
- Dropped the cancel_*_sync() calls on the intel_pmt_dev_create() failure and skip paths. They ran after the device was already freed, but with triggers now rejected until setup completes no work can be pending there.
- End the trigger poll without an event when the log is cleared or rearmed while it is running.
- Cancel a stale poll only after the new trigger has been written, so a failed trigger leaves the previous poll in place.
- Run the probe-time check under control_mutex, in the same critical section that enables triggers.
- Run the poll on the freezable workqueue so it does not read the device during suspend.
- Rebased onto review-ilpo-next and adapted to the crashlog register helpers now returning errors (Michal's additions). A failed status read counts as not complete.
- Rewrote the ABI

v1: https://lore.kernel.org/all/[email protected]/

David E. Box (1):
platform/x86/intel/pmt: Notify userspace when crashlogs complete

 .../ABI/testing/sysfs-class-intel_pmt         |  32 ++++
 drivers/platform/x86/intel/pmt/crashlog.c     | 138 +++++++++++++++++-
 2 files changed, 165 insertions(+), 5 deletions(-)

base-commit: 9d3475065167197742b0882aff21cf8e78393277

Signature · 1 line
2.43.0