drm/i915/pmu: Check if pmu is closed before stopping event
authorjsg <jsg@openbsd.org>
Fri, 3 Nov 2023 03:24:23 +0000 (03:24 +0000)
committerjsg <jsg@openbsd.org>
Fri, 3 Nov 2023 03:24:23 +0000 (03:24 +0000)
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

index 41264e0..5b55f6a 100644 (file)
@@ -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;
 }