[PATCH 8/8] [TEST] use ttm pin for stolen object lifetime
Robert Beckett
bob.beckett at collabora.com
Mon May 30 13:48:56 UTC 2022
see if this fixes the free with lock held.
if not, revert to page pinning, but ttm_bo_put before returing error if
page pinning fails.
Signed-off-by: Robert Beckett <bob.beckett at collabora.com>
---
drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index d8af77347e6d..b656b425bbbe 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -998,6 +998,13 @@ static void i915_ttm_delayed_free(struct drm_i915_gem_object *obj)
{
GEM_BUG_ON(!obj->ttm.created);
+ /* stolen objects are pinned for lifetime. Unpin before putting */
+ if (i915_gem_object_is_stolen(obj)) {
+ ttm_bo_reserve(i915_gem_to_ttm(obj), true, false, NULL);
+ ttm_bo_unpin(i915_gem_to_ttm(obj));
+ ttm_bo_unreserve(i915_gem_to_ttm(obj));
+ }
+
ttm_bo_put(i915_gem_to_ttm(obj));
}
@@ -1264,11 +1271,8 @@ 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;
- }
+ if (is_stolen)
+ ttm_bo_pin(i915_gem_to_ttm(obj));
i915_gem_object_unlock(obj);
return 0;
--
2.25.1
More information about the Intel-gfx-trybot
mailing list