public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Don't destroy the vma placeholder during execbuffer reservation
@ 2013-08-20 11:56 Chris Wilson
  2013-08-20 13:19 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2013-08-20 11:56 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ben Widawsky

The execbuffer handle and exec_link were moved from the object into the
vma. As the vma may be unbound and destroyed whilst attempting to
reserve the execbuffer objects (either through a forced unbind to fix up
a misalignment or through an evict-everything call) we need to prevent
the free of the i915_vma itself. Otherwise not only is the list of
objects to reserve corrupt, but we continue to reference stale vma
entries.

Fixes kernel crash with i-g-t/gem_evict_everything

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Bugzilla; https://bugs.freedesktop.org/show_bug.cgi?id=68298
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: 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 bf32b1e..33bbd69 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4256,6 +4256,11 @@ void i915_gem_vma_destroy(struct i915_vma *vma)
 {
 	WARN_ON(vma->node.allocated);
 	list_del(&vma->vma_link);
+
+	/* Keep the vma as a placeholder in the execbuffer reservation lists */
+	if (!list_empty(&vma->exec_list))
+		return;
+
 	kfree(vma);
 }
 
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/i915: Don't destroy the vma placeholder during execbuffer reservation
  2013-08-20 11:56 [PATCH] drm/i915: Don't destroy the vma placeholder during execbuffer reservation Chris Wilson
@ 2013-08-20 13:19 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2013-08-20 13:19 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx, Ben Widawsky

On Tue, Aug 20, 2013 at 12:56:40PM +0100, Chris Wilson wrote:
> The execbuffer handle and exec_link were moved from the object into the
> vma. As the vma may be unbound and destroyed whilst attempting to
> reserve the execbuffer objects (either through a forced unbind to fix up
> a misalignment or through an evict-everything call) we need to prevent
> the free of the i915_vma itself. Otherwise not only is the list of
> objects to reserve corrupt, but we continue to reference stale vma
> entries.
> 
> Fixes kernel crash with i-g-t/gem_evict_everything
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Bugzilla; https://bugs.freedesktop.org/show_bug.cgi?id=68298
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ben Widawsky <ben@bwidawsk.net>

Yeah, I think this is about as simple&clear as it gets. vmas used by
execbuf simply have a bit a strange lifetime rule ... Queued for -next,
thanks for the patch. Merged quickly since I want to keep the bisect fail
window small, but I'll smash the test result from QA on top as soon as we
have it.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-20 13:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-20 11:56 [PATCH] drm/i915: Don't destroy the vma placeholder during execbuffer reservation Chris Wilson
2013-08-20 13:19 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox