From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH] drm/xe: Use dma-fence array for media GT TLB invalidations in PT code
Date: Thu, 22 Aug 2024 18:08:25 -0700 [thread overview]
Message-ID: <20240823010825.2005759-1-matthew.brost@intel.com> (raw)
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@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
next reply other threads:[~2024-08-23 1:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 1:08 Matthew Brost [this message]
2024-08-23 1:14 ` ✓ CI.Patch_applied: success for drm/xe: Use dma-fence array for media GT TLB invalidations in PT code Patchwork
2024-08-23 1:14 ` ✓ CI.checkpatch: " Patchwork
2024-08-23 1:15 ` ✓ CI.KUnit: " Patchwork
2024-08-23 1:27 ` ✓ CI.Build: " Patchwork
2024-08-23 1:29 ` ✓ CI.Hooks: " Patchwork
2024-08-23 1:30 ` ✓ CI.checksparse: " Patchwork
2024-08-23 1:50 ` ✗ CI.BAT: failure " Patchwork
2024-08-23 11:52 ` ✗ CI.FULL: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240823010825.2005759-1-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox