Skip to content

Fix i915 pmu on bind/unbind

Lucas De Marchi dri-devel intel-gfx linux-perf-users lkml oe-lkp stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7perf/core: Add pmu get/putinclude/linux/perf_event.h kernel/events/core.c+31 -41 reply
2/7drm/i915/pmu: Fix crash due to use-after-freedrivers/gpu/drm/i915/i915_pmu.c+20 -140 replies
3/7drm/i915/pmu: Use event_to_pmu()drivers/gpu/drm/i915/i915_pmu.c+2 -31 reply
4/7drm/i915/pmu: Drop is_igp()drivers/gpu/drm/i915/i915_pmu.c+3 -142 replies
5/7drm/i915/pmu: Let resource survive unbinddrivers/gpu/drm/i915/i915_pmu.c+16 -51 reply
6/7drm/i915/pmu: Lazy unregisterdrivers/gpu/drm/i915/i915_pmu.c+9 -156 replies
7/7drm/i915/pmu: Do not set event_init to NULLdrivers/gpu/drm/i915/i915_pmu.c+3 -50 replies

Reviews trailers per patch

2 of 7 patches have a Reviewed-by or Acked-by.

PatchAshutosh Dixit
1/7
2/7
3/7R-b
4/7R-b
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] Fix i915 pmu on bind/unbind

This is intended to fix the pmu integration in i915 when the device unbinds. I don't have the hardware to test, but I belive a similar issue occurs with any driver using perf_pmu_unregister() if they can unbind from the device - in drm subsystem, that would be the amd driver.

Previous attempts I could find:
1) https://lore.kernel.org/lkml/[email protected]/
2) https://lore.kernel.org/all/[email protected]/

I think (2) is a no-go as it tries to do everything from the i915 side by force-closing the fd.

I believe this series is simpler* than (1), but that could could also be a good alternative if we want to go with that approach.

First patch is to perf. The rest is to i915 that builds on that and moves the unregister bit by bit to be done later, after the last reference to i915 is dropped. Peter/Ingo, could I get your opinion on this or if (1) would be a good alternative? Thanks.

* simpler, but see downside mentioned in patch 6

Lucas De Marchi (7):
perf/core: Add pmu get/put
drm/i915/pmu: Fix crash due to use-after-free
drm/i915/pmu: Use event_to_pmu()
drm/i915/pmu: Drop is_igp()
drm/i915/pmu: Let resource survive unbind
drm/i915/pmu: Lazy unregister
drm/i915/pmu: Do not set event_init to NULL

 drivers/gpu/drm/i915/i915_pmu.c | 103 ++++++++++++++++----------------
 include/linux/perf_event.h      |   3 +
 kernel/events/core.c            |  32 ++++++++--
 3 files changed, 81 insertions(+), 57 deletions(-)
Signature · 1 line
2.43.0