public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Add locking around framebuffer_references--
Date: Fri, 13 Jun 2014 10:15:26 +0200	[thread overview]
Message-ID: <20140613081526.GI5821@phenom.ffwll.local> (raw)
In-Reply-To: <1402647053-23299-1-git-send-email-ville.syrjala@linux.intel.com>

On Fri, Jun 13, 2014 at 11:10:53AM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> obj->framebuffer_references isn't an atomic_t so the decrement needs to
> be protected by some lock. struct_mutex seems like the appropriate lock
> here, and we may already take it for the obj unref anyway.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_display.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b5cbb28..5762726 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11504,11 +11504,14 @@ static void intel_setup_outputs(struct drm_device *dev)
>  
>  static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
>  {
> +	struct drm_device *dev = fb->dev;
>  	struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
>  
>  	drm_framebuffer_cleanup(fb);
> +	mutex_lock(&dev->struct_mutex);
>  	WARN_ON(!intel_fb->obj->framebuffer_references--);
> -	drm_gem_object_unreference_unlocked(&intel_fb->obj->base);
> +	drm_gem_object_unreference(&intel_fb->obj->base);
> +	mutex_unlock(&dev->struct_mutex);
>  	kfree(intel_fb);
>  }
>  
> -- 
> 1.8.5.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

      reply	other threads:[~2014-06-13  8:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13  8:10 [PATCH] drm/i915: Add locking around framebuffer_references-- ville.syrjala
2014-06-13  8:15 ` Daniel Vetter [this message]

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=20140613081526.GI5821@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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