Skip to content

Commit 4cbed77

Browse files
unerligerodrigovivi
authored andcommitted
drm/i915/pmu: Check if pmu is closed before stopping event
When the driver unbinds, pmu is unregistered and i915->uabi_engines is set to RB_ROOT. Due to this, when i915 PMU tries to stop the engine events, it issues a warn_on because engine lookup fails. All perf hooks are taking care of this using a pmu->closed flag that is set when PMU unregisters. The stop event seems to have been left out. Check for pmu->closed in pmu_event_stop as well. Based on discussion here - https://patchwork.freedesktop.org/patch/492079/?series=105790&rev=2 v2: s/is/if/ in commit title v3: Add fixes tag and cc stable Cc: <[email protected]> # v5.11+ Fixes: b00bccb ("drm/i915/pmu: Handle PCI unbind") Signed-off-by: Umesh Nerlige Ramappa <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 31f6a06) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 78cc55e commit 4cbed77

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/gpu/drm/i915/i915_pmu.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,18 @@ static void i915_pmu_event_start(struct perf_event *event, int flags)
832832

833833
static void i915_pmu_event_stop(struct perf_event *event, int flags)
834834
{
835+
struct drm_i915_private *i915 =
836+
container_of(event->pmu, typeof(*i915), pmu.base);
837+
struct i915_pmu *pmu = &i915->pmu;
838+
839+
if (pmu->closed)
840+
goto out;
841+
835842
if (flags & PERF_EF_UPDATE)
836843
i915_pmu_event_read(event);
837844
i915_pmu_disable(event);
845+
846+
out:
838847
event->hw.state = PERF_HES_STOPPED;
839848
}
840849

0 commit comments

Comments
 (0)