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: thomas.hellstrom@linux.intel.com
Subject: [RFC PATCH 7/8] drm/xe: Add ULLS migration job support to GuC submission
Date: Sun, 11 Aug 2024 19:47:16 -0700	[thread overview]
Message-ID: <20240812024717.3584636-8-matthew.brost@intel.com> (raw)
In-Reply-To: <20240812024717.3584636-1-matthew.brost@intel.com>

Reduce max jobs but 1 to avoid overflow of semaphores, directly set hwe
tail for ULLS, set current job sempahore, and supress submit H2G for
ULLS aside from first ULLS submission.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index da63be550d4d..aa1e8a76bd0c 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -706,7 +706,7 @@ static void wq_item_append(struct xe_exec_queue *q)
 }
 
 #define RESUME_PENDING	~0x0ull
-static void submit_exec_queue(struct xe_exec_queue *q)
+static void submit_exec_queue(struct xe_sched_job *job, struct xe_exec_queue *q)
 {
 	struct xe_guc *guc = exec_queue_to_guc(q);
 	struct xe_device *xe = guc_to_xe(guc);
@@ -716,6 +716,8 @@ static void submit_exec_queue(struct xe_exec_queue *q)
 	u32 num_g2h = 0;
 	int len = 0;
 	bool extra_submit = false;
+	bool ulls = test_bit(JOB_FLAG_ULLS, &job->fence->flags);
+	bool ulls_first = test_bit(JOB_FLAG_ULLS_FIRST, &job->fence->flags);
 
 	xe_assert(xe, exec_queue_registered(q));
 
@@ -724,6 +726,12 @@ static void submit_exec_queue(struct xe_exec_queue *q)
 	else
 		xe_lrc_set_ring_tail(lrc, lrc->ring.tail);
 
+	if (ulls && !ulls_first)
+		xe_hw_engine_write_ring_tail(q->hwe, lrc->ring.tail);
+
+	if (ulls)
+		xe_lrc_set_ulls_semaphore(lrc, xe_sched_job_lrc_seqno(job));
+
 	if (exec_queue_suspended(q) && !xe_exec_queue_is_parallel(q))
 		return;
 
@@ -740,13 +748,14 @@ static void submit_exec_queue(struct xe_exec_queue *q)
 		set_exec_queue_pending_enable(q);
 		set_exec_queue_enabled(q);
 		trace_xe_exec_queue_scheduling_enable(q);
-	} else {
+	} else if (!ulls || ulls_first) {
 		action[len++] = XE_GUC_ACTION_SCHED_CONTEXT;
 		action[len++] = q->guc->id;
 		trace_xe_exec_queue_submit(q);
 	}
 
-	xe_guc_ct_send(&guc->ct, action, len, g2h_len, num_g2h);
+	if (!ulls || ulls_first || num_g2h)
+		xe_guc_ct_send(&guc->ct, action, len, g2h_len, num_g2h);
 
 	if (extra_submit) {
 		len = 0;
@@ -777,7 +786,7 @@ guc_exec_queue_run_job(struct drm_sched_job *drm_job)
 			register_exec_queue(q);
 		if (!lr)	/* LR jobs are emitted in the exec IOCTL */
 			q->ring_ops->emit_job(job);
-		submit_exec_queue(q);
+		submit_exec_queue(job, q);
 	}
 
 	if (lr) {
@@ -1435,6 +1444,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
 	struct xe_guc_exec_queue *ge;
 	long timeout;
 	int err, i;
+	int max_jobs = (q->lrc[0]->ring.size / MAX_JOB_SIZE_BYTES);
 
 	xe_assert(xe, xe_device_uc_enabled(guc_to_xe(guc)));
 
@@ -1449,11 +1459,15 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
 	for (i = 0; i < MAX_STATIC_MSG_TYPE; ++i)
 		INIT_LIST_HEAD(&ge->static_msgs[i].link);
 
+	if (q->vm && q->vm->flags & XE_VM_FLAG_MIGRATION) {
+		xe_assert(xe, LRC_MIGRATION_ULLS_SEMAPORE_COUNT - 1 < max_jobs);
+		max_jobs = LRC_MIGRATION_ULLS_SEMAPORE_COUNT - 1;
+	}
+
 	timeout = (q->vm && xe_vm_in_lr_mode(q->vm)) ? MAX_SCHEDULE_TIMEOUT :
 		  msecs_to_jiffies(q->sched_props.job_timeout_ms);
 	err = xe_sched_init(&ge->sched, &drm_sched_ops, &xe_sched_ops,
-			    get_submit_wq(guc),
-			    q->lrc[0]->ring.size / MAX_JOB_SIZE_BYTES, 64,
+			    get_submit_wq(guc), max_jobs, 64,
 			    timeout, guc_to_gt(guc)->ordered_wq, NULL,
 			    q->name, gt_to_xe(q->gt)->drm.dev);
 	if (err)
-- 
2.34.1


  parent reply	other threads:[~2024-08-12  2:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12  2:47 [RFC PATCH 0/8] ULLS for kernel submission of migration jobs Matthew Brost
2024-08-12  2:47 ` [RFC PATCH 1/8] drm/xe: Add xe_hw_engine_write_ring_tail Matthew Brost
2024-08-12  2:47 ` [RFC PATCH 2/8] drm/xe: Add ULLS support to LRC Matthew Brost
2024-08-12  2:47 ` [RFC PATCH 3/8] drm/xe: Add ULLS flags for jobs Matthew Brost
2024-08-12  2:47 ` [RFC PATCH 4/8] drm/xe: Add ULLS migration job support to migration layer Matthew Brost
2024-08-12  2:47 ` [RFC PATCH 5/8] drm/xe: Add MI_SEMAPHORE_WAIT instruction defs Matthew Brost
2024-08-12  2:47 ` [RFC PATCH 6/8] drm/xe: Add ULLS migration job support to ring ops Matthew Brost
2024-08-12  2:47 ` Matthew Brost [this message]
2024-08-12  2:47 ` [RFC PATCH 8/8] drm/xe: Enable ULLS migration jobs when opening LR VM Matthew Brost
2024-08-12  2:51 ` ✓ CI.Patch_applied: success for ULLS for kernel submission of migration jobs Patchwork
2024-08-12  2:52 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-12  2:53 ` ✓ CI.KUnit: success " Patchwork
2024-08-12  3:05 ` ✓ CI.Build: " Patchwork
2024-08-12  3:07 ` ✓ CI.Hooks: " Patchwork
2024-08-12  3:08 ` ✓ CI.checksparse: " Patchwork
2024-08-12  3:28 ` ✓ CI.BAT: " Patchwork
2024-08-12  4:31 ` ✗ CI.FULL: failure " Patchwork
2024-08-12  8:53 ` [RFC PATCH 0/8] " Thomas Hellström
2024-08-12 17:26   ` Matthew Brost
2024-09-16 13:55     ` Matthew Brost
2024-09-17  6:59       ` Thomas Hellström
2024-09-17 14:39         ` Matthew Brost

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=20240812024717.3584636-8-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=thomas.hellstrom@linux.intel.com \
    /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