Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Subject: [PATCH v2 2/2] drm/xe: Don't issue TLB invalidations for VMAs if using execlists
Date: Wed, 21 Feb 2024 19:59:06 -0800	[thread overview]
Message-ID: <20240222035906.3835257-3-matthew.brost@intel.com> (raw)
In-Reply-To: <20240222035906.3835257-1-matthew.brost@intel.com>

TLB invalidations for VMAs are currently only implemented with the GuC
enabled. Do not issue TLB invalidations if using execlists. A longer
term fix would be up the TLB invalidation layer to be execlist aware.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_pt.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
index 7f54bc3e389d..c4de13bcfe85 100644
--- a/drivers/gpu/drm/xe/xe_pt.c
+++ b/drivers/gpu/drm/xe/xe_pt.c
@@ -1256,9 +1256,11 @@ __xe_pt_bind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_exec_queue
 	 */
 	if ((rebind && !xe_vm_in_lr_mode(vm) && !vm->batch_invalidate_tlb) ||
 	    (!rebind && xe_vm_has_scratch(vm) && xe_vm_in_preempt_fence_mode(vm))) {
-		ifence = kzalloc(sizeof(*ifence), GFP_KERNEL);
-		if (!ifence)
-			return ERR_PTR(-ENOMEM);
+		if (!vm->xe->info.force_execlist) {
+			ifence = kzalloc(sizeof(*ifence), GFP_KERNEL);
+			if (!ifence)
+				return ERR_PTR(-ENOMEM);
+		}
 	}
 
 	rfence = kzalloc(sizeof(*rfence), GFP_KERNEL);
@@ -1574,7 +1576,7 @@ __xe_pt_unbind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_exec_queu
 	struct xe_vm *vm = xe_vma_vm(vma);
 	u32 num_entries;
 	struct dma_fence *fence = NULL;
-	struct invalidation_fence *ifence;
+	struct invalidation_fence *ifence = NULL;
 	struct xe_range_fence *rfence;
 
 	LLIST_HEAD(deferred);
@@ -1593,9 +1595,11 @@ __xe_pt_unbind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_exec_queu
 	xe_pt_calc_rfence_interval(vma, &unbind_pt_update, entries,
 				   num_entries);
 
-	ifence = kzalloc(sizeof(*ifence), GFP_KERNEL);
-	if (!ifence)
-		return ERR_PTR(-ENOMEM);
+	if (!vm->xe->info.force_execlist) {
+		ifence = kzalloc(sizeof(*ifence), GFP_KERNEL);
+		if (!ifence)
+			return ERR_PTR(-ENOMEM);
+	}
 
 	rfence = kzalloc(sizeof(*rfence), GFP_KERNEL);
 	if (!rfence) {
@@ -1625,13 +1629,15 @@ __xe_pt_unbind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_exec_queu
 			dma_fence_wait(fence, false);
 
 		/* TLB invalidation must be done before signaling unbind */
-		err = invalidation_fence_init(tile->primary_gt, ifence, fence, vma);
-		if (err) {
-			dma_fence_put(fence);
-			kfree(ifence);
-			return ERR_PTR(err);
+		if (ifence) {
+			err = invalidation_fence_init(tile->primary_gt, ifence, fence, vma);
+			if (err) {
+				dma_fence_put(fence);
+				kfree(ifence);
+				return ERR_PTR(err);
+			}
+			fence = &ifence->base.base;
 		}
-		fence = &ifence->base.base;
 
 		/* add shared fence now for pagetable delayed destroy */
 		dma_resv_add_fence(xe_vm_resv(vm), fence,
-- 
2.34.1


  parent reply	other threads:[~2024-02-22  3:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22  3:59 [PATCH v2 0/2] Fix execlist mode Matthew Brost
2024-02-22  3:59 ` [PATCH v2 1/2] drm/xe: Fix execlist splat Matthew Brost
2024-02-22 21:40   ` Rodrigo Vivi
2024-02-22  3:59 ` Matthew Brost [this message]
2024-02-22 21:42   ` [PATCH v2 2/2] drm/xe: Don't issue TLB invalidations for VMAs if using execlists Rodrigo Vivi
2024-02-22 22:55     ` Matthew Brost
2024-02-22  4:30 ` ✓ CI.Patch_applied: success for Fix execlist mode (rev3) Patchwork
2024-02-22  4:30 ` ✓ CI.checkpatch: " Patchwork
2024-02-22  4:32 ` ✓ CI.KUnit: " Patchwork
2024-02-22  4:46 ` ✓ CI.Build: " Patchwork
2024-02-22  4:47 ` ✓ CI.Hooks: " Patchwork
2024-02-22  4:49 ` ✓ CI.checksparse: " 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=20240222035906.3835257-3-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