mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Maíra Canal" <mcanal@igalia.com>
Cc: "Melissa Wen" <mwen@igalia.com>, "Emma Anholt" <emma@anholt.net>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"André Almeida" <andrealmeid@igalia.com>,
	"Juan A . Suarez" <jasuarez@igalia.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/v3d: switch to drmm_mutex_init
Date: Tue, 8 Nov 2022 16:56:51 +0100	[thread overview]
Message-ID: <Y2p8QzOMH/nm4IM3@phenom.ffwll.local> (raw)
In-Reply-To: <20221107224656.278135-2-mcanal@igalia.com>

On Mon, Nov 07, 2022 at 07:46:55PM -0300, Maíra Canal wrote:
> mutex_init() is supposed to be balanced by a call to mutex_destroy(), but
> this is not currently happening on the v3d driver.
> 
> Considering the introduction of a DRM-managed mutex_init variant, switch
> to drmm_mutex_init.
> 
> Signed-off-by: Maíra Canal <mcanal@igalia.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/v3d/v3d_gem.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
> index b8980440d137..96af1cb5202a 100644
> --- a/drivers/gpu/drm/v3d/v3d_gem.c
> +++ b/drivers/gpu/drm/v3d/v3d_gem.c
> @@ -10,6 +10,7 @@
>  #include <linux/sched/signal.h>
>  #include <linux/uaccess.h>
>  
> +#include <drm/drm_managed.h>
>  #include <drm/drm_syncobj.h>
>  #include <uapi/drm/v3d_drm.h>
>  
> @@ -1075,10 +1076,18 @@ v3d_gem_init(struct drm_device *dev)
>  
>  	spin_lock_init(&v3d->mm_lock);
>  	spin_lock_init(&v3d->job_lock);
> -	mutex_init(&v3d->bo_lock);
> -	mutex_init(&v3d->reset_lock);
> -	mutex_init(&v3d->sched_lock);
> -	mutex_init(&v3d->cache_clean_lock);
> +	ret = drmm_mutex_init(dev, &v3d->bo_lock);
> +	if (ret)
> +		return ret;
> +	ret = drmm_mutex_init(dev, &v3d->reset_lock);
> +	if (ret)
> +		return ret;
> +	ret = drmm_mutex_init(dev, &v3d->sched_lock);
> +	if (ret)
> +		return ret;
> +	ret = drmm_mutex_init(dev, &v3d->cache_clean_lock);
> +	if (ret)
> +		return ret;
>  
>  	/* Note: We don't allocate address 0.  Various bits of HW
>  	 * treat 0 as special, such as the occlusion query counters
> -- 
> 2.38.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2022-11-08 15:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 22:46 [PATCH 0/2] Balance mutex_init and mutex_destroy calls Maíra Canal
2022-11-07 22:46 ` [PATCH 1/2] drm/v3d: switch to drmm_mutex_init Maíra Canal
2022-11-08 15:56   ` Daniel Vetter [this message]
2022-11-07 22:46 ` [PATCH 2/2] drm/v3d: add missing mutex_destroy Maíra Canal
2022-11-08 16:01   ` Daniel Vetter

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=Y2p8QzOMH/nm4IM3@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@gmail.com \
    --cc=andrealmeid@igalia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=jasuarez@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcanal@igalia.com \
    --cc=mwen@igalia.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

all inboxes | Powered by JetHome®