FAILED: patch "[PATCH] drm/i915/gt: Use i915_vm_put on ppgtt_create error paths" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Possible dependencies:
20e377e7b2e7 ("drm/i915/gt: Use i915_vm_put on ppgtt_create error paths") b0b0f2d225da ("drm/i915: Create a dummy object for gen6 ppgtt")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 20e377e7b2e7c327039f10db80ba5bcc1f6c882d Mon Sep 17 00:00:00 2001
From: Chris Wilson <[email protected]>
Date: Mon, 26 Sep 2022 16:33:33 +0100
Subject: [PATCH] drm/i915/gt: Use i915_vm_put on ppgtt_create error paths
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Now that the scratch page and page directories have a reference back to the i915_address_space, we cannot do an immediate free of the ppgtt upon error as those buffer objects will perform a later i915_vm_put in their deferred frees.
The downside is that by replacing the onion unwind along the error paths, the ppgtt cleanup must handle a partially constructed vm. This includes ensuring that the vm->cleanup is set prior to the error path.
drivers/gpu/drm/i915/gt/gen6_ppgtt.c +8 -8
@@ -247,6 +247,7 @@ static int gen6_ppgtt_init_scratch(struct gen6_ppgtt *ppgtt)i915_gem_object_put (vm->scratch[1 ]); err_scratch0:i915_gem_object_put (vm->scratch[0 ]); + vm->scratch[0 ] =NULL ;return ret; }
@@ -268,9 +269,10 @@ static void gen6_ppgtt_cleanup(struct i915_address_space *vm)gen6_ppgtt_free_pd (ppgtt);free_scratch (vm); -mutex_destroy (&ppgtt->flush); +if (ppgtt->base.pd) +free_pd (&ppgtt->base.vm, ppgtt->base.pd); -free_pd (&ppgtt->base.vm, ppgtt->base.pd); +mutex_destroy (&ppgtt->flush); } static void pd_vma_bind(struct i915_address_space *vm,
@@ -449,19 +451,17 @@ struct i915_ppgtt *gen6_ppgtt_create(struct intel_gt *gt) err =gen6_ppgtt_init_scratch (ppgtt);if (err) - goto err_free; + goto err_put; ppgtt->base.pd =gen6_alloc_top_pd (ppgtt);if (IS_ERR (ppgtt->base.pd)) { err =PTR_ERR (ppgtt->base.pd); - goto err_scratch; + goto err_put; }return &ppgtt->base; -err_scratch: -free_scratch (&ppgtt->base.vm); -err_free: -kfree (ppgtt); +err_put: +i915_vm_put (&ppgtt->base.vm);return ERR_PTR (err); }
drivers/gpu/drm/i915/gt/gen8_ppgtt.c +30 -28
101 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_gtt.c +3 -0
@@ -405,6 +405,9 @@ void free_scratch(struct i915_address_space *vm) {int i; +if (!vm->scratch[0 ]) +return ; +for (i =0 ; i <= vm->top; i++)i915_gem_object_put (vm->scratch[i]); }