Message ID | 1376111536-12461-3-git-send-email-benjamin.widawsky@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Aug 09, 2013 at 10:12:14PM -0700, Ben Widawsky wrote: > In upcoming code, it will be possible for a vma to have been created, > but no space reserved for it in the address space. The drm_mm semantics > are such that trying to remove an unallocated node is not allowed. But not allocated during unbind, i.e. calling unbind() before bind()? That seems scary enough. -Chris
On Sat, Aug 10, 2013 at 09:45:05AM +0100, Chris Wilson wrote: > On Fri, Aug 09, 2013 at 10:12:14PM -0700, Ben Widawsky wrote: > > In upcoming code, it will be possible for a vma to have been created, > > but no space reserved for it in the address space. The drm_mm semantics > > are such that trying to remove an unallocated node is not allowed. > > But not allocated during unbind, i.e. calling unbind() before bind()? > That seems scary enough. > -Chris > The condition can occur if we create a vma, fail to bind it, and then free up the object (which tries to unbind). As I alluded to, this cannot happen until we do the execbufer vma creation. The example for which is can happen is if we have some object created, with a vma AFAICT, this condition cannot occur until we actually are using multiple VMs, but once we are the following can occur: object X created for context Y VMA-Y created for object X VMA-Z created for object X, but fails before or during bind VMA-Z persists object X destroyed free calls unbind on all VMAs. VMA-Z has no node allocated for it. One way to may this better is to not call unbind() if it isn't allocated, and simply call vma_destroy(). I don't really care. You tell me what you want.
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index a60c773..c287072 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2629,7 +2629,8 @@ int i915_vma_unbind(struct i915_vma *vma) if (i915_is_ggtt(vma->vm)) obj->map_and_fenceable = true; - drm_mm_remove_node(&vma->node); + if (drm_mm_node_allocated(&vma->node)) + drm_mm_remove_node(&vma->node); i915_gem_vma_destroy(vma); /* Since the unbound list is global, only move to that list if
In upcoming code, it will be possible for a vma to have been created, but no space reserved for it in the address space. The drm_mm semantics are such that trying to remove an unallocated node is not allowed. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> --- drivers/gpu/drm/i915/i915_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)