* [PATCH] drm/i915/pmu: Check if pmu is closed before stopping event
@ 2023-10-20 15:24 Umesh Nerlige Ramappa
2023-10-24 12:20 ` [Intel-gfx] " Andi Shyti
2023-10-25 11:53 ` Andi Shyti
0 siblings, 2 replies; 4+ messages in thread
From: Umesh Nerlige Ramappa @ 2023-10-20 15:24 UTC (permalink / raw)
To: intel-gfx; +Cc: Tvrtko Ursulin, stable
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: <stable@vger.kernel.org> # v5.11+
Fixes: b00bccb3f0bb ("drm/i915/pmu: Handle PCI unbind")
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_pmu.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 108b675088ba..f861863eb7c1 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -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;
}
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/pmu: Check if pmu is closed before stopping event
2023-10-20 15:24 [PATCH] drm/i915/pmu: Check if pmu is closed before stopping event Umesh Nerlige Ramappa
@ 2023-10-24 12:20 ` Andi Shyti
2023-10-25 19:36 ` Umesh Nerlige Ramappa
2023-10-25 11:53 ` Andi Shyti
1 sibling, 1 reply; 4+ messages in thread
From: Andi Shyti @ 2023-10-24 12:20 UTC (permalink / raw)
To: Umesh Nerlige Ramappa; +Cc: intel-gfx, stable
Hi Umesh,
On Fri, Oct 20, 2023 at 08:24:41AM -0700, Umesh Nerlige Ramappa wrote:
> 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: <stable@vger.kernel.org> # v5.11+
> Fixes: b00bccb3f0bb ("drm/i915/pmu: Handle PCI unbind")
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
argh! 4th time that this patch has been sent. Please next time
use:
git format-patch -v <version number>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
No need to resend :-)
Andi
> ---
> drivers/gpu/drm/i915/i915_pmu.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 108b675088ba..f861863eb7c1 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -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;
> }
>
> --
> 2.38.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/pmu: Check if pmu is closed before stopping event
2023-10-20 15:24 [PATCH] drm/i915/pmu: Check if pmu is closed before stopping event Umesh Nerlige Ramappa
2023-10-24 12:20 ` [Intel-gfx] " Andi Shyti
@ 2023-10-25 11:53 ` Andi Shyti
1 sibling, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2023-10-25 11:53 UTC (permalink / raw)
To: Umesh Nerlige Ramappa; +Cc: intel-gfx, stable
Hi Umesh,
On Fri, Oct 20, 2023 at 08:24:41AM -0700, Umesh Nerlige Ramappa wrote:
> 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: <stable@vger.kernel.org> # v5.11+
> Fixes: b00bccb3f0bb ("drm/i915/pmu: Handle PCI unbind")
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
the failure from the shards tests looks unrelated.
Please next time don't forget to add a versioning to the patches
you are sending.
Pushed in drm-intel-gt-next.
Thank you,
Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/pmu: Check if pmu is closed before stopping event
2023-10-24 12:20 ` [Intel-gfx] " Andi Shyti
@ 2023-10-25 19:36 ` Umesh Nerlige Ramappa
0 siblings, 0 replies; 4+ messages in thread
From: Umesh Nerlige Ramappa @ 2023-10-25 19:36 UTC (permalink / raw)
To: Andi Shyti; +Cc: intel-gfx, stable
On Tue, Oct 24, 2023 at 02:20:33PM +0200, Andi Shyti wrote:
>Hi Umesh,
>
>On Fri, Oct 20, 2023 at 08:24:41AM -0700, Umesh Nerlige Ramappa wrote:
>> 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: <stable@vger.kernel.org> # v5.11+
>> Fixes: b00bccb3f0bb ("drm/i915/pmu: Handle PCI unbind")
>> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
>argh! 4th time that this patch has been sent. Please next time
>use:
>
> git format-patch -v <version number>
>
>Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
>
>No need to resend :-)
Sorry about the versioning. Will keep inn mind next time.
Thanks,
Umesh
>
>Andi
>
>> ---
>> drivers/gpu/drm/i915/i915_pmu.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
>> index 108b675088ba..f861863eb7c1 100644
>> --- a/drivers/gpu/drm/i915/i915_pmu.c
>> +++ b/drivers/gpu/drm/i915/i915_pmu.c
>> @@ -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;
>> }
>>
>> --
>> 2.38.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-25 19:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20 15:24 [PATCH] drm/i915/pmu: Check if pmu is closed before stopping event Umesh Nerlige Ramappa
2023-10-24 12:20 ` [Intel-gfx] " Andi Shyti
2023-10-25 19:36 ` Umesh Nerlige Ramappa
2023-10-25 11:53 ` Andi Shyti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox