From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: intel-xe@lists.freedesktop.org,
Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: Re: [PATCH] drm/xe/oa: Destroy the stream_lock mutex
Date: Fri, 28 Jun 2024 10:31:36 -0700 [thread overview]
Message-ID: <87msn5x9c7.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <Zn7r0a+8uKOaeLWP@orsosgc001>
On Fri, 28 Jun 2024 09:58:57 -0700, Umesh Nerlige Ramappa wrote:
>
> On Thu, Jun 27, 2024 at 10:21:25PM -0700, Ashutosh Dixit wrote:
> > The mutex allocated in xe_oa_stream_init() was never previously
> > destroyed. Do so now.
> >
> > Fixes: e936f885f1e9 ("drm/xe/oa/uapi: Expose OA stream fd")
> > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>
> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>
> Since we are holding a drm reference, what is the logic behind using
> drmm_mutex_init() for some mutexes and just a mutex_init for this one?
I was sort of expecting this question :)
So drmm_mutex_init() is being used for mutexes which are allocated in
device probe, so they will be automatically freed in device unbind/remove.
The mutex here is not a per device mutex, it's a per stream mutex. So
better IMO to free it when the stream closes, so that's why an explicit
mutex_destroy() during xe_oa_stream_destroy() here (since multiple OA
streams can be opened/closed between probe and remove).
(Though, considering that mutex_destroy() is a nop unless
CONFIG_DEBUG_MUTEXES is set (see include/linux/mutex.h), drmm_mutex_init()
will not be the end of the world either). But I thought just take the safe
way out.
Thanks.
--
Ashutosh
> > ---
> > drivers/gpu/drm/xe/xe_oa.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
> > index 6cc3f0217341..4188516a7816 100644
> > --- a/drivers/gpu/drm/xe/xe_oa.c
> > +++ b/drivers/gpu/drm/xe/xe_oa.c
> > @@ -824,6 +824,8 @@ static void xe_oa_stream_destroy(struct xe_oa_stream *stream)
> >
> > WRITE_ONCE(u->exclusive_stream, NULL);
> >
> > + mutex_destroy(&stream->stream_lock);
> > +
> > xe_oa_disable_metric_set(stream);
> > xe_exec_queue_put(stream->k_exec_q);
> >
> > --
> > 2.41.0
> >
next prev parent reply other threads:[~2024-06-28 17:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 5:21 [PATCH] drm/xe/oa: Destroy the stream_lock mutex Ashutosh Dixit
2024-06-28 5:30 ` ✓ CI.Patch_applied: success for " Patchwork
2024-06-28 5:30 ` ✓ CI.checkpatch: " Patchwork
2024-06-28 5:31 ` ✓ CI.KUnit: " Patchwork
2024-06-28 16:58 ` [PATCH] " Umesh Nerlige Ramappa
2024-06-28 17:31 ` Dixit, Ashutosh [this message]
2024-07-01 16:32 ` ✓ CI.Patch_applied: success for drm/xe/oa: Destroy the stream_lock mutex (rev2) Patchwork
2024-07-01 16:32 ` ✓ CI.checkpatch: " Patchwork
2024-07-01 16:34 ` ✓ CI.KUnit: " Patchwork
2024-07-01 16:46 ` ✓ CI.Build: " Patchwork
2024-07-01 16:48 ` ✓ CI.Hooks: " Patchwork
2024-07-01 16:49 ` ✓ CI.checksparse: " Patchwork
2024-07-01 17:23 ` ✓ CI.BAT: " Patchwork
2024-07-01 18:38 ` ✗ CI.FULL: failure " Patchwork
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=87msn5x9c7.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox