All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Intel GFX <intel-gfx@lists.freedesktop.org>,
	Ben Widawsky <ben@bwidawsk.net>
Subject: [PATCH 2/2] drm/i915: Unpin stolen pages
Date: Fri, 31 May 2013 14:46:20 -0700	[thread overview]
Message-ID: <1370036780-13482-2-git-send-email-ben@bwidawsk.net> (raw)
In-Reply-To: <1370036780-13482-1-git-send-email-ben@bwidawsk.net>

The way the stolen handling works is we take a pin on the backing pages,
but we never actually get a reference to the bo. On freeing objects
allocated with stolen memory, the final unref will end up freeing the
object with pinned pages count left. To enable an assertion to catch
bugs in this code path, this patch cleans up that remaining pin.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index e5b6a92..a18a485 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3857,6 +3857,11 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
 		dev_priv->mm.interruptible = was_interruptible;
 	}
 
+	/* Stolen objects don't hold a ref, but do hold pin count. Fix that up
+	 * before progressing. */
+	if (obj->stolen)
+		i915_gem_object_unpin_pages(obj);
+
 	obj->pages_pin_count = 0;
 	i915_gem_object_put_pages(obj);
 	i915_gem_object_free_mmap_offset(obj);
-- 
1.8.3

  parent reply	other threads:[~2013-05-31 21:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31 18:28 [PATCH 1/4] drm/i915: Demote unknown param to DRM_DEBUG Ben Widawsky
2013-05-31 18:28 ` [PATCH 2/4] drm/i915: Unbind the fb Ben Widawsky
2013-05-31 18:45   ` [PATCH 2/4] [v2] " Ben Widawsky
2013-05-31 19:39     ` Chris Wilson
2013-05-31 20:08       ` Ben Widawsky
2013-05-31 18:28 ` [PATCH 3/4] drm/i915: unpin pages at unbind Ben Widawsky
2013-05-31 18:46   ` Chris Wilson
2013-05-31 21:46     ` [PATCH 1/2] drm/i915: Make stolen use pin pages Ben Widawsky
2013-05-31 21:44       ` Ben Widawsky
2013-05-31 21:46       ` Ben Widawsky [this message]
2013-05-31 23:51         ` [PATCH 2/2] drm/i915: Unpin stolen pages Chris Wilson
2013-06-01  9:17           ` Daniel Vetter
2013-06-01 11:34             ` Chris Wilson
2013-06-01 13:13               ` Daniel Vetter
2013-06-03  8:36                 ` Chris Wilson
2013-06-03  8:52                   ` Daniel Vetter
2013-06-03 22:54                     ` Ben Widawsky
2013-05-31 18:28 ` [PATCH 4/4] drm/i915: Rename the gtt_list to global_list Ben Widawsky
2013-05-31 18:40   ` Chris Wilson
2013-05-31 18:38 ` [PATCH 1/4] drm/i915: Demote unknown param to DRM_DEBUG Chris Wilson

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=1370036780-13482-2-git-send-email-ben@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.