drm/i915/pmu: Check if pmu is closed before stopping event
Subsystems (2)
PATCH 1/1 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
--- drivers/gpu/drm/i915/i915_pmu.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/i915/i915_pmu.c +9 -0
@@ -831,9 +831,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 ; }
Signature · 1 line
2.38.1
Quoted 7 lines · Umesh Nerlige Ramappa
When the driver unbinds, pmu is unregistered and
i915->uabi_enginesis set toRB_ROOT. Due to this, when i915 PMU tries to stop the engine events, it issues awarn_onbecause engine lookup fails.All perf hooks are taking care of this using a
pmu->closedflag that is set when PMU unregisters. The stop event seems to have been left out.
Quoted 8 lines
Check for
pmu->closedinpmu_event_stopas well.Based on discussion here -
https://patchwork.freedesktop.org/patch/492079/?series=105790&rev=2v2: s/is/if/ in commit title
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/i915/i915_pmu.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/gpu/drm/i915/i915_pmu.c +5
-0@@ -831,9 +831,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)
drivers/gpu/drm/i915/i915_pmu.c static void i915_pmu_event_start(struct perf_event *event, int flags) · line 848
Quoted 10 lines
drivers/gpu/drm/i915/i915_pmu.c +4
-0+ goto out; +if (flags &PERF_EF_UPDATE )i915_pmu_event_read (event);i915_pmu_disable (event); + +out: event->hw.state =PERF_HES_STOPPED ; }
You reminded me of this yesterday and it looks fine to me. Thanks for sending the fix!
Regards,
Tvrtko
Hi Umesh,
Quoted 7 lines · Umesh Nerlige Ramappa
When the driver unbinds, pmu is unregistered and
i915->uabi_enginesis set toRB_ROOT. Due to this, when i915 PMU tries to stop the engine events, it issues awarn_onbecause engine lookup fails.All perf hooks are taking care of this using a
pmu->closedflag that is set when PMU unregisters. The stop event seems to have been left out.
Quoted 6 lines
Check for
pmu->closedinpmu_event_stopas well.Based on discussion here -
https://patchwork.freedesktop.org/patch/492079/?series=105790&rev=2v2: s/is/if/ in commit title
Please, next time version your patches. This is the third time you send this, but there is only one 'v2' changelog.
Quoted 1 line
Signed-off-by Umesh Nerlige Ramappa <[email protected]>
With Tvrtko's tags:
Andi