Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Welty <brian.welty@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH 2/4] drm/xe: Add exec_queue.sched_props.job_timeout_ms
Date: Tue,  2 Jan 2024 13:17:29 -0800	[thread overview]
Message-ID: <20240102211731.6720-3-brian.welty@intel.com> (raw)
In-Reply-To: <20240102211731.6720-1-brian.welty@intel.com>

The purpose here is to allow to optimize exec_queue_set_job_timeout()
in follow-on patch.  Currently it does q->ops->set_job_timeout(...).
But we'd like to apply exec_queue_user_extensions much earlier and
q->ops cannot be called before __xe_exec_queue_init().

It will be much more efficient to instead only have to set
q->sched_props.job_timeout_ms when applying user extensions. That value
will then be used during q->ops->init().

Signed-off-by: Brian Welty <brian.welty@intel.com>
---
 drivers/gpu/drm/xe/xe_exec_queue.c       | 2 ++
 drivers/gpu/drm/xe/xe_exec_queue_types.h | 2 ++
 drivers/gpu/drm/xe/xe_guc_submit.c       | 3 ++-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
index 94ae87540854..e78b13845417 100644
--- a/drivers/gpu/drm/xe/xe_exec_queue.c
+++ b/drivers/gpu/drm/xe/xe_exec_queue.c
@@ -65,6 +65,8 @@ static struct xe_exec_queue *__xe_exec_queue_alloc(struct xe_device *xe,
 	q->sched_props.timeslice_us = hwe->eclass->sched_props.timeslice_us;
 	q->sched_props.preempt_timeout_us =
 				hwe->eclass->sched_props.preempt_timeout_us;
+	q->sched_props.job_timeout_ms =
+				hwe->eclass->sched_props.job_timeout_ms;
 
 	if (xe_exec_queue_is_parallel(q)) {
 		q->parallel.composite_fence_ctx = dma_fence_context_alloc(1);
diff --git a/drivers/gpu/drm/xe/xe_exec_queue_types.h b/drivers/gpu/drm/xe/xe_exec_queue_types.h
index 3d7e704ec3d9..882eb5373980 100644
--- a/drivers/gpu/drm/xe/xe_exec_queue_types.h
+++ b/drivers/gpu/drm/xe/xe_exec_queue_types.h
@@ -142,6 +142,8 @@ struct xe_exec_queue {
 		u32 timeslice_us;
 		/** @preempt_timeout_us: preemption timeout in micro-seconds */
 		u32 preempt_timeout_us;
+		/** @job_timeout_ms: job timeout in milliseconds */
+		u32 job_timeout_ms;
 	} sched_props;
 
 	/** @compute: compute exec queue state */
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 21ac68e3246f..6cbf41ad9c8c 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -1218,7 +1218,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
 	init_waitqueue_head(&ge->suspend_wait);
 
 	timeout = (q->vm && xe_vm_in_lr_mode(q->vm)) ? MAX_SCHEDULE_TIMEOUT :
-		  q->hwe->eclass->sched_props.job_timeout_ms;
+		  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,
@@ -1361,6 +1361,7 @@ static int guc_exec_queue_set_job_timeout(struct xe_exec_queue *q, u32 job_timeo
 	xe_assert(xe, !exec_queue_banned(q));
 	xe_assert(xe, !exec_queue_killed(q));
 
+	q->sched_props.job_timeout_ms = job_timeout_ms;
 	sched->base.timeout = job_timeout_ms;
 
 	return 0;
-- 
2.43.0


  parent reply	other threads:[~2024-01-02 21:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 21:17 [PATCH 0/4] Refactor xe_exec_queue_create to fix user extensions Brian Welty
2024-01-02 21:17 ` [PATCH 1/4] drm/xe: Refactor __xe_exec_queue_create() Brian Welty
2024-01-03  7:56   ` Matthew Brost
2024-01-02 21:17 ` Brian Welty [this message]
2024-01-03  8:14   ` [PATCH 2/4] drm/xe: Add exec_queue.sched_props.job_timeout_ms Matthew Brost
2024-01-02 21:17 ` [PATCH 3/4] drm/xe: Add exec_queue.sched_props.priority Brian Welty
2024-01-03  8:11   ` Matthew Brost
2024-01-03 18:15     ` Welty, Brian
2024-01-03 18:29       ` Matthew Brost
2024-01-02 21:17 ` [PATCH 4/4] drm/xe: Finish refactoring of exec_queue_create Brian Welty
2024-01-03  8:07   ` Matthew Brost
2024-01-03 18:16     ` Welty, Brian
2024-01-03 14:19 ` ✓ CI.Patch_applied: success for Refactor xe_exec_queue_create to fix user extensions Patchwork
2024-01-03 14:19 ` ✓ CI.checkpatch: " Patchwork
2024-01-03 14:20 ` ✓ CI.KUnit: " Patchwork
2024-01-03 14:28 ` ✓ CI.Build: " Patchwork
2024-01-03 14:28 ` ✓ CI.Hooks: " Patchwork
2024-01-03 14:29 ` ✓ CI.checksparse: " Patchwork
2024-01-03 15:05 ` ✓ 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=20240102211731.6720-3-brian.welty@intel.com \
    --to=brian.welty@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