I tried to come up with alternative and lockless approaches to make pmu work, but since the perf events are run in atomic context on PREEMPT_RT, ordinary spinlocks no longer work and forcewake and register accesses become problematic.
Disable perf events on PREEMPT_RT for now, without affecting !PREEMPT_RT users. Signed-off-by: Maarten Lankhorst <[email protected]> --- drivers/gpu/drm/i915/i915_pmu.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index 1c3bafda9c708..c2ff315de4481 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -1156,6 +1156,16 @@ void i915_pmu_register(struct drm_i915_private *i915) }; int ret = -ENOMEM; + /* + * PREEMPT_RT has problems with forcewake. Forcewake is used by the + * engine 'busy' event when guc submission is enabled, and to measure + * rc6 residency. + * + * Disable pmu events on PREEMPT_RT entirely to prevent deadlocks. + */ + if (IS_ENABLED(CONFIG_PREEMPT_RT)) + reeturn; + spin_lock_init(&pmu->lock); hrtimer_setup(&pmu->timer, i915_sample, CLOCK_MONOTONIC, HRTIMER_MODE_REL); init_rc6(pmu); -- 2.53.0
