[Intel-xe] [PATCH 4/4] drm/xe: Add DRM_XE_PREEMPT_TIMEOUT_COPY

Niranjana Vishwanathapura niranjana.vishwanathapura at intel.com
Mon Aug 14 16:20:51 UTC 2023


On Tue, Aug 08, 2023 at 11:24:11AM -0700, Niranjana Vishwanathapura wrote:
>Allow preemption timeout for copy engines 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).
>

Will remove this patch as we don't want a universal BCS preempt timout
config that applies across all platforms.

Niranjana

>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 | 12 ++++++++++++
> drivers/gpu/drm/xe/xe_hw_engine.c  |  4 ++++
> drivers/gpu/drm/xe/xe_hw_engine.h  |  6 ++++++
> 3 files changed, 22 insertions(+)
>
>diff --git a/drivers/gpu/drm/xe/Kconfig.profile b/drivers/gpu/drm/xe/Kconfig.profile
>index 5ca3305a22b6..219e13d3fd25 100644
>--- a/drivers/gpu/drm/xe/Kconfig.profile
>+++ b/drivers/gpu/drm/xe/Kconfig.profile
>@@ -43,6 +43,18 @@ config DRM_XE_PREEMPT_TIMEOUT_COMPUTE
> 	  before the timer expires, the HW will be reset to allow the more
> 	  important context to execute.
>
>+	  Value should be within the DRM_XE_PREEMPT_TIMEOUT_MIN/MAX limits.
>+	  This is adjustable via XE_ENGINE_SET_PROPERTY_PREEMPTION_TIMEOUT.
>+config DRM_XE_PREEMPT_TIMEOUT_COPY
>+	int "Preempt timeout for copy engines (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. 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.
>+
> 	  Value should be within the DRM_XE_PREEMPT_TIMEOUT_MIN/MAX limits.
> 	  This is adjustable via XE_ENGINE_SET_PROPERTY_PREEMPTION_TIMEOUT.
> config DRM_XE_PREEMPT_TIMEOUT_MAX
>diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
>index 57a0fb50852c..34b1fdd24b0e 100644
>--- a/drivers/gpu/drm/xe/xe_hw_engine.c
>+++ b/drivers/gpu/drm/xe/xe_hw_engine.c
>@@ -343,6 +343,8 @@ static u32 get_default_preempt_timeout(struct xe_hw_engine *hwe)
> 	if (hwe->class == XE_ENGINE_CLASS_RENDER ||
> 	    hwe->class == XE_ENGINE_CLASS_COMPUTE)
> 		return XE_HW_ENGINE_PREEMPT_TIMEOUT_COMPUTE;
>+	else if (hwe->class == XE_ENGINE_CLASS_COPY)
>+		return XE_HW_ENGINE_PREEMPT_TIMEOUT_COPY;
> 	else
> 		return XE_HW_ENGINE_PREEMPT_TIMEOUT;
> }
>@@ -575,6 +577,8 @@ int xe_hw_engines_init_early(struct xe_gt *gt)
> 	BUILD_BUG_ON(XE_HW_ENGINE_PREEMPT_TIMEOUT > XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX);
> 	BUILD_BUG_ON(XE_HW_ENGINE_PREEMPT_TIMEOUT_COMPUTE < XE_HW_ENGINE_PREEMPT_TIMEOUT_MIN);
> 	BUILD_BUG_ON(XE_HW_ENGINE_PREEMPT_TIMEOUT_COMPUTE > XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX);
>+	BUILD_BUG_ON(XE_HW_ENGINE_PREEMPT_TIMEOUT_COPY < XE_HW_ENGINE_PREEMPT_TIMEOUT_MIN);
>+	BUILD_BUG_ON(XE_HW_ENGINE_PREEMPT_TIMEOUT_COPY > XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX);
>
> 	for (i = 0; i < ARRAY_SIZE(gt->hw_engines); i++)
> 		hw_engine_init_early(gt, &gt->hw_engines[i], i);
>diff --git a/drivers/gpu/drm/xe/xe_hw_engine.h b/drivers/gpu/drm/xe/xe_hw_engine.h
>index c4f0969efc06..66a611f4942a 100644
>--- a/drivers/gpu/drm/xe/xe_hw_engine.h
>+++ b/drivers/gpu/drm/xe/xe_hw_engine.h
>@@ -41,6 +41,12 @@ struct drm_printer;
> #else
> #define XE_HW_ENGINE_PREEMPT_TIMEOUT_COMPUTE XE_HW_ENGINE_PREEMPT_TIMEOUT
> #endif
>+#ifdef CONFIG_DRM_XE_PREEMPT_TIMEOUT_COPY
>+#define XE_HW_ENGINE_PREEMPT_TIMEOUT_COPY \
>+	(CONFIG_DRM_XE_PREEMPT_TIMEOUT_COPY * 1000)
>+#else
>+#define XE_HW_ENGINE_PREEMPT_TIMEOUT_COPY XE_HW_ENGINE_PREEMPT_TIMEOUT
>+#endif
> #ifdef CONFIG_DRM_XE_PREEMPT_TIMEOUT_MIN
> #define XE_HW_ENGINE_PREEMPT_TIMEOUT_MIN CONFIG_DRM_XE_PREEMPT_TIMEOUT_MIN
> #else
>-- 
>2.21.0.rc0.32.g243a4c7e27
>


More information about the Intel-xe mailing list