From: Jani Nikula <jani.nikula@linux.intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/pmu: Check is pmu is closed before stopping event
Date: Mon, 23 Oct 2023 18:13:46 +0300 [thread overview]
Message-ID: <87bkcpbcd1.fsf@intel.com> (raw)
In-Reply-To: <20231019182720.3742536-1-umesh.nerlige.ramappa@intel.com>
On Thu, 19 Oct 2023, Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> 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
>
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@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;
This inspired me to write [1]. Please review.
BR,
Jani.
[1] https://patchwork.freedesktop.org/series/125464/
> +
> + 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;
> }
--
Jani Nikula, Intel
next prev parent reply other threads:[~2023-10-23 15:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-19 18:27 [Intel-gfx] [PATCH] drm/i915/pmu: Check is pmu is closed before stopping event Umesh Nerlige Ramappa
2023-10-23 15:13 ` Jani Nikula [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-10-19 18:23 Umesh Nerlige Ramappa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bkcpbcd1.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=umesh.nerlige.ramappa@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.