[PATCH] drm/xe: Use dma-fence array for media GT TLB invalidations in PT code
Matthew Brost
matthew.brost at intel.com
Fri Aug 23 01:08:25 UTC 2024
Using a chain fence is problematic as these cannot be installed in
timeout drm sync objects. Use a dma-fence-array instead at the cost of
an extra failure point.
Fixes: 40520283e0fd ("drm/xe: Invalidate media_gt TLBs in PT code")
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
drivers/gpu/drm/xe/xe_pt.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
index 6c6714af3d5d..f8d4839ef8ce 100644
--- a/drivers/gpu/drm/xe/xe_pt.c
+++ b/drivers/gpu/drm/xe/xe_pt.c
@@ -3,7 +3,7 @@
* Copyright © 2022 Intel Corporation
*/
-#include <linux/dma-fence-chain.h>
+#include <linux/dma-fence-array.h>
#include "xe_pt.h"
@@ -1983,7 +1983,8 @@ xe_pt_update_ops_run(struct xe_tile *tile, struct xe_vma_ops *vops)
&vops->pt_update_ops[tile->id];
struct dma_fence *fence;
struct invalidation_fence *ifence = NULL, *mfence = NULL;
- struct dma_fence_chain *chain_fence = NULL;
+ struct dma_fence **fences = NULL;
+ struct dma_fence_array *cf = NULL;
struct xe_range_fence *rfence;
struct xe_vma_op *op;
int err = 0, i;
@@ -2022,8 +2023,8 @@ xe_pt_update_ops_run(struct xe_tile *tile, struct xe_vma_ops *vops)
err = -ENOMEM;
goto free_ifence;
}
- chain_fence = dma_fence_chain_alloc();
- if (!chain_fence) {
+ fences = kmalloc_array(2, sizeof(*fences), GFP_KERNEL);
+ if (!fences) {
err = -ENOMEM;
goto free_ifence;
}
@@ -2068,9 +2069,17 @@ xe_pt_update_ops_run(struct xe_tile *tile, struct xe_vma_ops *vops)
invalidation_fence_init(tile->media_gt, mfence, fence,
pt_update_ops->start,
pt_update_ops->last, vm->usm.asid);
- dma_fence_chain_init(chain_fence, &ifence->base.base,
- &mfence->base.base, 0);
- fence = &chain_fence->base;
+ fences[0] = &ifence->base.base;
+ fences[1] = &mfence->base.base;
+ cf = dma_fence_array_create(2, fences,
+ vm->composite_fence_ctx,
+ vm->composite_fence_seqno++,
+ false);
+ if (!cf) {
+ err = -ENOMEM;
+ goto put_ifence;
+ }
+ fence = &cf->base;
} else {
fence = &ifence->base.base;
}
@@ -2105,10 +2114,16 @@ xe_pt_update_ops_run(struct xe_tile *tile, struct xe_vma_ops *vops)
return fence;
+put_ifence:
+ if (pt_update_ops->needs_userptr_lock)
+ up_read(&vm->userptr.notifier_lock);
+ dma_fence_put(&ifence->base.base);
+ if (mfence)
+ dma_fence_put(&mfence->base.base);
free_rfence:
kfree(rfence);
free_ifence:
- dma_fence_chain_free(chain_fence);
+ kfree(fences);
kfree(mfence);
kfree(ifence);
kill_vm_tile1:
--
2.34.1
More information about the Intel-xe
mailing list