public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/4] [v2] drm/i915: Remove node only when allocated
@ 2013-08-14  1:09 Ben Widawsky
  2013-08-14  1:09 ` [PATCH 2/4] [v3] drm/i915: cleanup map&fence in bind Ben Widawsky
                   ` (4 more replies)
  0 siblings, 5 replies; 29+ messages in thread
From: Ben Widawsky @ 2013-08-14  1:09 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ben Widawsky, Paulo Zanoni, Ben Widawsky

VMAs can be created and not bound. One may think of it as lazy cleanup,
and safely gloss over the conditions which manufacture it. In either
case, when the object backing the i915 vma is destroyed, we must cleanup
the vma without stumbling into a bunch of pitfalls that assume the vma
is bound.

NOTE: I was pretty certain the above condition could only happen when we
introduced the use of VMAs being looked up at execbuf, and already
existing. Paulo has hit this though, so I must be missing something. As
I believe the patch is correct anyway, therefore I won't scratch my head
too hard.

v2: use goto destroy as a compromise (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
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 3d9e248b..4a58ead 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2606,6 +2606,9 @@ int i915_vma_unbind(struct i915_vma *vma)
 	if (list_empty(&vma->vma_link))
 		return 0;
 
+	if (!drm_mm_node_allocated(&vma->node))
+		goto destroy;
+
 	if (obj->pin_count)
 		return -EBUSY;
 
@@ -2643,6 +2646,8 @@ int i915_vma_unbind(struct i915_vma *vma)
 		obj->map_and_fenceable = true;
 
 	drm_mm_remove_node(&vma->node);
+
+destroy:
 	i915_gem_vma_destroy(vma);
 
 	/* Since the unbound list is global, only move to that list if
-- 
1.8.3.4

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

end of thread, other threads:[~2013-08-15 21:42 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14  1:09 [PATCH 1/4] [v2] drm/i915: Remove node only when allocated Ben Widawsky
2013-08-14  1:09 ` [PATCH 2/4] [v3] drm/i915: cleanup map&fence in bind Ben Widawsky
2013-08-14  8:18   ` Daniel Vetter
2013-08-14 17:27     ` Ben Widawsky
2013-08-14 18:08       ` Daniel Vetter
2013-08-14  1:09 ` [PATCH 3/4] drm: WARN when removing unallocated node Ben Widawsky
2013-08-14  8:52   ` [Intel-gfx] " Daniel Vetter
2013-08-14  1:09 ` [PATCH 4/4] [v4] drm/i915: Convert execbuf code to use vmas Ben Widawsky
2013-08-14  1:11   ` Ben Widawsky
2013-08-14  7:58     ` Chris Wilson
     [not found]       ` <20130814224358.GA21854@nuc-i3427.alporthouse.com>
2013-08-14 23:22         ` Ben Widawsky
2013-08-14  9:38   ` Split up execbuf vma conversion Daniel Vetter
2013-08-14  9:38     ` [PATCH 1/4] drm/i915: s/obj->exec_list/obj->obj_exec_link Daniel Vetter
2013-08-14  9:42       ` Daniel Vetter
2013-08-14  9:38     ` [PATCH 2/4] drm/i915: Switch eviction code to use vmas Daniel Vetter
2013-08-14  9:38     ` [PATCH 3/4] drm/i915: prepare bind_to_vm for preallocated vma Daniel Vetter
2013-08-14  9:38     ` [PATCH 4/4] drm/i915: Convert execbuf code to use vmas Daniel Vetter
2013-08-14  9:59       ` [PATCH] drm/i915: inline vma_create into lookup_or_create_vma Daniel Vetter
2013-08-14 11:49         ` Chris Wilson
2013-08-14 12:08           ` Daniel Vetter
2013-08-14 12:14           ` Daniel Vetter
2013-08-14 16:47         ` Daniel Vetter
2013-08-14 17:35           ` Ben Widawsky
2013-08-14 11:54       ` [PATCH 4/4] drm/i915: Convert execbuf code to use vmas Chris Wilson
2013-08-14  8:06 ` [PATCH 1/4] [v2] drm/i915: Remove node only when allocated Daniel Vetter
2013-08-14  8:15   ` Daniel Vetter
2013-08-15 14:05     ` Daniel Vetter
2013-08-15 21:42       ` Ben Widawsky
2013-08-14  8:19 ` Chris Wilson

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