[Intel-xe] [RFC 3/3] drm/xe: Add DRM_XE_PREEMPT_TIMEOUT_COMPUTE_COPY

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


Allow preemption timeout for copy engines on a heavy compute systems
to be specified as a config option.

If all copy engines are thrashing away at the PCIe bus, plus all
compute engines doing the same, then the per copy bandwidth becomes
tiny. That results in copy operations that should take milliseconds
actually taking seconds. So bump the pre-emption timeout to allow for
the worst case scenario (currently believed to be around 2s).

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 454a49b206c9..305014df2871 100644
--- a/drivers/gpu/drm/xe/Kconfig.profile
+++ b/drivers/gpu/drm/xe/Kconfig.profile
@@ -24,3 +24,17 @@ config DRM_XE_PREEMPT_TIMEOUT_COMPUTE
           This is adjustable via XE_ENGINE_SET_PROPERTY_PREEMPTION_TIMEOUT.
 
           May be 0 to disable the timeout.
+
+config DRM_XE_PREEMPT_TIMEOUT_COMPUTE_COPY
+        int "Preempt timeout for copy engines on heavy compute systems (ms, jiffy granularity)"
+        default 2500 # milliseconds
+        help
+          How long to wait (in milliseconds) for a preemption event to occur
+          when submitting a new context to a copy engine on a heavy compute
+          system. 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 99c34cab0d15..a590254f14e7 100644
--- a/drivers/gpu/drm/xe/xe_engine.c
+++ b/drivers/gpu/drm/xe/xe_engine.c
@@ -39,6 +39,13 @@ static inline void xe_engine_set_preempt_timeout(struct xe_engine *e)
 		e->sched_props.preempt_timeout_us =
 			CONFIG_DRM_XE_PREEMPT_TIMEOUT_COMPUTE * 1000;
 #endif
+
+#if defined(CONFIG_DRM_XE_PREEMPT_TIMEOUT_COMPUTE_COPY)
+	if (e->class == XE_ENGINE_CLASS_COPY &&
+	    hweight64(e->gt->info.engine_mask & XE_HW_ENGINE_BCS_MASK) >= 2)
+		e->sched_props.preempt_timeout_us =
+			CONFIG_DRM_XE_PREEMPT_TIMEOUT_COMPUTE_COPY * 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