[Intel-xe] [RFC 2/3] drm/xe: Add DRM_XE_PREEMPT_TIMEOUT_COMPUTE

Niranjana Vishwanathapura niranjana.vishwanathapura at intel.com
Sat Jun 10 00:12:25 UTC 2023


Allow preemption timeout for compute engines to be specified as a
config option. The purpose is actually to give compute tasks longer
time to reach a pre-emption point after a pre-emption request has been
issued. This is necessary because Gen12 does not support mid-thread
pre-emption and compute tasks can have long running threads.

Signed-off-by: John Harrison <John.C.Harrison at Intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
---
 drivers/gpu/drm/xe/Kconfig.profile | 14 ++++++++++++++
 drivers/gpu/drm/xe/xe_engine.c     |  7 +++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/xe/Kconfig.profile b/drivers/gpu/drm/xe/Kconfig.profile
index 27be86adc6cb..454a49b206c9 100644
--- a/drivers/gpu/drm/xe/Kconfig.profile
+++ b/drivers/gpu/drm/xe/Kconfig.profile
@@ -10,3 +10,17 @@ config DRM_XE_PREEMPT_TIMEOUT
           This is adjustable via XE_ENGINE_SET_PROPERTY_PREEMPTION_TIMEOUT.
 
           May be 0 to disable the timeout.
+
+config DRM_XE_PREEMPT_TIMEOUT_COMPUTE
+        int "Preempt timeout for compute engines (ms, jiffy granularity)"
+        default 7500 # milliseconds
+        help
+          How long to wait (in milliseconds) for a preemption event to occur
+          when submitting a new context to a compute capable engine. If the
+          current context does not hit an arbitration point and yield to HW
+          before the timer expires, the HW will be reset to allow the more
+          important context to execute.
+
+          This is adjustable via XE_ENGINE_SET_PROPERTY_PREEMPTION_TIMEOUT.
+
+          May be 0 to disable the timeout.
diff --git a/drivers/gpu/drm/xe/xe_engine.c b/drivers/gpu/drm/xe/xe_engine.c
index cdc4bfdaf015..99c34cab0d15 100644
--- a/drivers/gpu/drm/xe/xe_engine.c
+++ b/drivers/gpu/drm/xe/xe_engine.c
@@ -32,6 +32,13 @@ static inline void xe_engine_set_preempt_timeout(struct xe_engine *e)
 	e->sched_props.preempt_timeout_us =
 		CONFIG_DRM_XE_PREEMPT_TIMEOUT * 1000;
 #endif
+
+#if defined(CONFIG_DRM_XE_PREEMPT_TIMEOUT_COMPUTE)
+	if (e->class == XE_ENGINE_CLASS_RENDER ||
+	    e->class == XE_ENGINE_CLASS_COMPUTE)
+		e->sched_props.preempt_timeout_us =
+			CONFIG_DRM_XE_PREEMPT_TIMEOUT_COMPUTE * 1000;
+#endif
 }
 
 static struct xe_engine *__xe_engine_create(struct xe_device *xe,
-- 
2.21.0.rc0.32.g243a4c7e27



More information about the Intel-xe mailing list