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>
#include <linux/device.h>
#include "xe_device.h"
+#include "xe_pm.h"
#include "xe_pmu.h"
/**
struct xe_device *xe = container_of(event->pmu, typeof(*xe), pmu.base);
drm_WARN_ON(&xe->drm, event->parent);
+ xe_pm_runtime_put(xe);
drm_dev_put(&xe->drm);
}
if (!event->parent) {
drm_dev_get(&xe->drm);
+ xe_pm_runtime_get(xe);
event->destroy = xe_pmu_event_destroy;
}