Skip to contentSkip to conversation

drm/i915: Return -ENOENT for unknown contexts

PATCH In review Mika Kuoppala 2 participants 3 messages Apr 16, 2014 – Apr 17, 2014

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

PATCH 1/1 drm/i915: Return -ENOENT for unknown contexts

From: Mika Kuoppala <[email protected]>

If hw_contexts are disabled, we always return the per file descriptor default context stats. Make sure that the context is correctly given and fail accordingly if not.

Testcase: igt/gem_reset_stats/params

---
 drivers/gpu/drm/i915/i915_gem_context.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +5 -1
index 30b355a..85c890c 100644
@@ -582,8 +582,12 @@ i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id)
 {
 	struct i915_hw_context *ctx;
 
-	if (!HAS_HW_CONTEXTS(file_priv->dev_priv->dev))
+	if (!HAS_HW_CONTEXTS(file_priv->dev_priv->dev)) {
+		if (id != DEFAULT_CONTEXT_ID)
+			return ERR_PTR(-ENOENT);
+
 		return file_priv->private_default_ctx;
+	}
 
 	ctx = (struct i915_hw_context *)idr_find(&file_priv->context_idr, id);
 	if (!ctx)
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 8 lines · Mika Kuoppala

From: Mika Kuoppala <[email protected]>

If hw_contexts are disabled, we always return the per file descriptor default context stats. Make sure that the context is correctly given and fail accordingly if not.

Testcase: igt/gem_reset_stats/params

This code is obsolete, and the bug should be already fixed by

commit 691e6415c891b8b2b082a120b896b443531c4d45

Author: Chris Wilson <[email protected]>
Date:   Wed Apr 9 09:07:36 2014 +0100

drm/i915: Always use kref tracking for all contexts.

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 10 lines · Chris Wilson
Quoted 8 lines · Mika Kuoppala

From: Mika Kuoppala <[email protected]>

If hw_contexts are disabled, we always return the per file descriptor default context stats. Make sure that the context is correctly given and fail accordingly if not.

Testcase: igt/gem_reset_stats/params

Quoted 7 lines

This code is obsolete, and the bug should be already fixed by

commit 691e6415c891b8b2b082a120b896b443531c4d45

Author: Chris Wilson <[email protected]>
Date:   Wed Apr 9 09:07:36 2014 +0100

drm/i915: Always use kref tracking for all contexts.

Agreed. I should have run it against fixes in addition to dinq.

-Mika

Quoted 4 lines

-Chris

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