Skip to content

Fix crash due to open pmu events during unbind

Umesh Nerlige Ramappa intel-gfx oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2i915/pmu: Add pmu_teardown helperdrivers/gpu/drm/i915/i915_pmu.c+56 -500 replies
2/2i915/pmu: Cleanup pending events on unbinddrivers/gpu/drm/i915/i915_pmu.c drivers/gpu/drm/i915/i915_pmu.h+110 -14 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/2] Fix crash due to open pmu events during unbind

Once a user opens an fd for a perf event, if the driver undergoes a function level reset (FLR), the resources are not cleaned up as expected. For this discussion FLR is defined as a PCI unbind followed by a bind. perf_pmu_unregister() would cleanup everything, but when the user closes the perf fd much later, perf_release() is called and we encounter null pointer dereferences and/or list corruption in that path which require a reboot to recover.

The only approach that worked to resolve this was to close the file associated with the event such that the relevant cleanup happens w.r.t. the open file. To do so, use the event->owner task and find the file relevant to the event and close it. This relies on the file->private_data matching the event object.

Test-with: [email protected]

Umesh Nerlige Ramappa (2):
i915/pmu: Add pmu_teardown helper
i915/pmu: Cleanup pending events on unbind

 drivers/gpu/drm/i915/i915_pmu.c | 192 ++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/i915_pmu.h |  15 +++
 2 files changed, 161 insertions(+), 46 deletions(-)
Signature · 1 line
2.34.1