From 636f8a005022eaee4fcc9400dc3dd17c858b374c Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 3 Nov 2023 03:24:23 +0000 Subject: [PATCH] drm/i915/pmu: Check if pmu is closed before stopping event From Umesh Nerlige Ramappa eded5f5261b8ff14417f9441934a1865b379b7db in linux-6.1.y/6.1.61 4cbed7702eb775cca22fff6827a549092cb59f61 in mainline linux --- sys/dev/pci/drm/i915/i915_pmu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/dev/pci/drm/i915/i915_pmu.c b/sys/dev/pci/drm/i915/i915_pmu.c index 41264e05801..5b55f6a5834 100644 --- a/sys/dev/pci/drm/i915/i915_pmu.c +++ b/sys/dev/pci/drm/i915/i915_pmu.c @@ -760,9 +760,18 @@ static void i915_pmu_event_start(struct perf_event *event, int flags) static void i915_pmu_event_stop(struct perf_event *event, int flags) { + struct drm_i915_private *i915 = + container_of(event->pmu, typeof(*i915), pmu.base); + struct i915_pmu *pmu = &i915->pmu; + + if (pmu->closed) + goto out; + if (flags & PERF_EF_UPDATE) i915_pmu_event_read(event); i915_pmu_disable(event); + +out: event->hw.state = PERF_HES_STOPPED; } -- 2.20.1