Skip to contentSkip to conversation

drm/i915: reject GTT domain in relocations

PATCH In review Daniel Vetter 3 participants 3 messages Dec 2, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: reject GTT domain in relocations

This confuses our domain tracking and can (for gtt write domains) lead to a subsequent oops.

Tested by tests/gem_exec_bad_domains from i-g-t.

---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +3 -2
index 98bd628..d369eac 100644
@@ -308,8 +308,9 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
 			  reloc->write_domain);
 		return ret;
 	}
-	if (unlikely((reloc->write_domain | reloc->read_domains) & I915_GEM_DOMAIN_CPU)) {
-		DRM_ERROR("reloc with read/write CPU domains: "
+	if (unlikely((reloc->write_domain | reloc->read_domains)
+		     & ~I915_GEM_GPU_DOMAINS)) {
+		DRM_ERROR("reloc with read/write non-GPU domains: "
 			  "obj %p target %d offset %d "
 			  "read %08x write %08x",
 			  obj, reloc->target_handle,
Signature · 1 line
1.7.7.3
Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Vetter
Quoted 6 lines · Daniel Vetter

This confuses our domain tracking and can (for gtt write domains) lead to a subsequent oops.

Tested by tests/gem_exec_bad_domains from i-g-t.

If it was in deliberate use by userspace we would have been oopsing,

In a similar vein is to add a
BUG_ON(obj->base.write_domain & ~I915_GEM_GPU_DOMAINS)
to move_to_active(). With this loop-hole closed, adding an invalid write buffer to the active list should only be possible through a kernel programming error (and helps remind us about what the limits upon the active list are).
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre