]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/pmu: Fix PMU enable vs execlists tasklet race
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Mon, 5 Feb 2018 09:34:48 +0000 (09:34 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 6 Feb 2018 11:21:27 +0000 (11:21 +0000)
commit28e069f54a9f6122bc3c9d04ee0c03597980fc12
tree52b5efe9189d6a8c34eee8dbb8b813550bba0e39
parent6982b8c9912a84686219a8385d39d3b8c90ae3d8
drm/i915/pmu: Fix PMU enable vs execlists tasklet race

Commit 017241c2b4ee ("drm/i915: Lock out execlist tasklet while peeking
inside for busy-stats") added a tasklet_disable call in busy stats
enabling, but we failed to understand that the PMU enable callback runs
as an hard IRQ (IPI).

Consequence of this is that the PMU enable callback can interrupt the
execlists tasklet, and will then deadlock when it calls
intel_engine_stats_enable->tasklet_disable.

To fix this, I realized it is possible to move the engine stats enablement
and disablement to PMU event init and destroy hooks. This allows for much
simpler implementation since those hooks run in normal context (can
sleep).

v2: Extract engine_event_destroy. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Fixes: 017241c2b4ee ("drm/i915: Lock out execlist tasklet while peeking inside for busy-stats")
Testcase: igt/perf_pmu/enable-race-*
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180205093448.13877-1-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_pmu.c
drivers/gpu/drm/i915/intel_ringbuffer.h