All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [Intel-xe] [PATCH v3 2/3] drm/xe/bo: consider dma-resv fences for clear job
Date: Mon, 30 Oct 2023 16:10:19 +0000	[thread overview]
Message-ID: <20231030161016.54300-7-matthew.auld@intel.com> (raw)
In-Reply-To: <20231030161016.54300-5-matthew.auld@intel.com>

There could be active fences already in the dma-resv for the object
prior to clearing. Make sure to input them as dependencies for the clear
job.

v2 (Matt B):
  - We can use USAGE_KERNEL here, since it's only the move fences we
    care about here. Also add a comment.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/xe/xe_migrate.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index 009d728af762..e6a31f90ebdb 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -980,8 +980,6 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
 
 		size -= clear_L0;
 
-		/* TODO: Add dependencies here */
-
 		/* Preemption is enabled again by the ring ops. */
 		if (!clear_vram) {
 			emit_pte(m, bb, clear_L0_pt, clear_vram, &src_it, clear_L0,
@@ -1010,6 +1008,18 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
 		}
 
 		xe_sched_job_add_migrate_flush(job, flush_flags);
+		if (!fence) {
+			/*
+			 * There can't be anything userspace related at this
+			 * point, so we just need to respect any potential move
+			 * fences, which are always tracked as
+			 * DMA_RESV_USAGE_KERNEL.
+			 */
+			err = job_add_deps(job, bo->ttm.base.resv,
+					   DMA_RESV_USAGE_KERNEL);
+			if (err)
+				goto err_job;
+		}
 
 		xe_sched_job_arm(job);
 		dma_fence_put(fence);
@@ -1024,6 +1034,8 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
 		xe_bb_free(bb, fence);
 		continue;
 
+err_job:
+		xe_sched_job_put(job);
 err:
 		mutex_unlock(&m->job_mutex);
 		xe_bb_free(bb, NULL);
-- 
2.41.0


  parent reply	other threads:[~2023-10-30 16:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 16:10 [Intel-xe] [PATCH v3 0/3] Some eviction fixes Matthew Auld
2023-10-30 16:10 ` [Intel-xe] [PATCH v3 1/3] drm/xe/migrate: fix MI_ARB_ON_OFF usage Matthew Auld
2023-10-30 16:10 ` Matthew Auld [this message]
2023-10-30 16:10 ` [Intel-xe] [PATCH v3 3/3] drm/xe/bo: sync kernel fences for KMD buffers Matthew Auld
2023-10-30 16:13   ` Thomas Hellström
2023-10-30 17:06 ` [Intel-xe] ✓ CI.Patch_applied: success for Some eviction fixes (rev3) Patchwork
2023-10-30 17:06 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-10-30 17:07 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-10-30 17:14 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-10-30 17:15 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-10-30 17:16 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-10-30 17:45 ` [Intel-xe] ✗ CI.BAT: failure " Patchwork
2023-10-31  8:17 ` [Intel-xe] ✓ CI.Patch_applied: success for Some eviction fixes (rev4) Patchwork
2023-10-31  8:17 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-10-31  8:19 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-10-31  8:26 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-10-31  8:26 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-10-31  8:27 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-10-31  9:09 ` [Intel-xe] ✓ CI.BAT: " 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=20231030161016.54300-7-matthew.auld@intel.com \
    --to=matthew.auld@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.