Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/pmu: Get/put runtime pm on event init

When the event is created, make sure runtime pm is taken and later put:
in order to read an event counter the GPU needs to remain accessible and
doing a get/put during perf's read is not possible it's holding a
raw_spinlock.

Suggested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250124050411.2189060-4-lucas.demarchi@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

+3
+3
drivers/gpu/drm/xe/xe_pmu.c
··· 7 7 #include <linux/device.h> 8 8 9 9 #include "xe_device.h" 10 + #include "xe_pm.h" 10 11 #include "xe_pmu.h" 11 12 12 13 /** ··· 69 68 struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base); 70 69 71 70 drm_WARN_ON(&xe->drm, event->parent); 71 + xe_pm_runtime_put(xe); 72 72 drm_dev_put(&xe->drm); 73 73 } 74 74 ··· 102 100 103 101 if (!event->parent) { 104 102 drm_dev_get(&xe->drm); 103 + xe_pm_runtime_get(xe); 105 104 event->destroy = xe_pmu_event_destroy; 106 105 } 107 106