[PATCH 7/8] [TEST] fix lockdep possible circular locking issue

Robert Beckett bob.beckett at collabora.com
Thu May 26 20:34:20 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 3a883b6e0828..d8af77347e6d 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -1264,6 +1264,11 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
 	i915_gem_object_init_memory_region(obj, mem);
 	i915_ttm_adjust_domains_after_move(obj);
 	i915_ttm_adjust_gem_after_move(obj);
+	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