[PATCH 10/12] [TEST] fix lockdep possible circular locking issue

Robert Beckett bob.beckett at collabora.com
Tue Jun 14 17:13:39 UTC 2022


---
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 27 ++--------------------
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c    |  5 ++++
 2 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
index a0be086299c5..cc08ce0a2d1a 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
@@ -570,31 +570,8 @@ struct drm_i915_gem_object *
 i915_gem_object_create_stolen(struct drm_i915_private *i915,
 			      resource_size_t size)
 {
-	struct drm_i915_gem_object *obj;
-	int ret;
-
-	obj = i915_gem_object_create_region(i915->mm.stolen_region, size, 0,
-					    I915_BO_ALLOC_CONTIGUOUS);
-	if (IS_ERR(obj))
-		return obj;
-
-	ret = i915_gem_object_lock(obj, NULL);
-	if (ret)
-		goto err_lock;
-
-	ret = i915_gem_object_pin_pages(obj);
-	if (ret)
-		goto err_pin;
-
-	i915_gem_object_unlock(obj);
-
-	return obj;
-
-err_pin:
-	i915_gem_object_unlock(obj);
-err_lock:
-	i915_gem_object_put(obj);
-	return ERR_PTR(ret);
+	return i915_gem_object_create_region(i915->mm.stolen_region, size, 0,
+					     I915_BO_ALLOC_CONTIGUOUS);
 }
 
 static struct intel_memory_region *alloc_stolen_region(void)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index afed9cb0e383..e5c20e5d5e62 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -1243,6 +1243,11 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
 	i915_ttm_adjust_domains_after_move(obj);
 	i915_ttm_adjust_gem_after_move(obj);
 	obj->ttm.cache_level_override = false;
+	if (is_stolen) {
+		ret = i915_gem_object_pin_pages(obj);
+		if (ret)
+			return ret;
+	}
 	i915_gem_object_unlock(obj);
 
 	return 0;
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list