Skip to contentSkip to conversation

drm/xe: Add engine scheduler control interface

PATCH Superseded Tejas Upadhyay 2 participants 8 messages Jul 20, 2023

Subsystems (2)

v4 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v4 cover drm/xe: Add engine scheduler control interface

Patch series introduces this in several patches,
1. Add basic directory engine class under its GT, as below DUT# cat /sys/class/drm/cardX/device/tileN/gtN/engines/ ccs/ bcs/
2. Add default entries with its value for user to go back to default
3,4,5 : Add individual engine properties sysfs entry 6: Introduce min/max to control in what range these properties
can be set for elevated and non-elevated users.

VLK-46764, VLK-46767

V4 :
- Rebase the series
- Add CONFIG option to enable/disable min/max limitation on elevated user - Matt/Joonas
- Movement of engine related code to its own file
V3 :
- Improve class_mask logic
V2 :
- Rebase to solve conflicts
- Use sysfs_create_files in this patch - Niranjana
- Handle prototype error for xe_add_engine_defaults - CI hooks
- Remove unused member sysfs_hwe - Niranjana
- Restric min/max setting to #define default min/max for elevated user - Himal
- Remove some unrelated changes from patch - Niranjana

Testcase: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/commit/94ccbe7cdf8651d5b76588102eca545cb74caad8
Testcase: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/commit/0753ddf646df691cd1d2219192ce3a629f3e7e3f
Updated Testcase: https://patchwork.freedesktop.org/series/121046/

Tejas Upadhyay (6):
drm/xe: Add sysfs entries for engines under its GT drm/xe: Add sysfs for default engine scheduler properties drm/xe: Add job timeout engine property to sysfs drm/xe: Add timeslice duration engine property to sysfs drm/xe: Add sysfs for preempt reset timeout drm/xe: Add min/max cap for engine scheduler properties

 drivers/gpu/drm/xe/Kconfig                 |   7 +
 drivers/gpu/drm/xe/Kconfig.profile         |  45 ++
 drivers/gpu/drm/xe/Makefile                |   1 +
 drivers/gpu/drm/xe/xe_engine.c             |  47 +-
 drivers/gpu/drm/xe/xe_engine_class_sysfs.c | 684 +++++++++++++++++++++
 drivers/gpu/drm/xe/xe_engine_class_sysfs.h |  34 +
 drivers/gpu/drm/xe/xe_gt.c                 |   7 +
 drivers/gpu/drm/xe/xe_guc_submit.c         |   5 +-
 drivers/gpu/drm/xe/xe_hw_engine.c          |  11 +
 drivers/gpu/drm/xe/xe_hw_engine.h          |  31 +
 drivers/gpu/drm/xe/xe_hw_engine_types.h    |  24 +
 11 files changed, 890 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/Kconfig.profile
 create mode 100644 drivers/gpu/drm/xe/xe_engine_class_sysfs.c
 create mode 100644 drivers/gpu/drm/xe/xe_engine_class_sysfs.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/6 drm/xe: Add sysfs entries for engines under its GT

Add engines sysfs directory under its GT and
create sub directory for all engine class
(note its not per instance) present on GT.

For example,
DUT# cat /sys/class/drm/cardX/device/tileN/gtN/engines/ bcs/ ccs/

V3 :
- Move code in its own file
- Rename API name
V2 :
- Correct class mask logic - Himal
- Remove extra parenthesis

---
 drivers/gpu/drm/xe/Makefile                |   1 +
 drivers/gpu/drm/xe/xe_engine_class_sysfs.c | 111 +++++++++++++++++++++
 drivers/gpu/drm/xe/xe_engine_class_sysfs.h |  13 +++
 drivers/gpu/drm/xe/xe_gt.c                 |   7 ++
 4 files changed, 132 insertions(+)
 create mode 100644 drivers/gpu/drm/xe/xe_engine_class_sysfs.c
 create mode 100644 drivers/gpu/drm/xe/xe_engine_class_sysfs.h
drivers/gpu/drm/xe/Makefile +1 -0
index 336f0eb8f91e..ce4ab54342db 100644
@@ -51,6 +51,7 @@ xe-y += xe_bb.o \
 	xe_device.o \
 	xe_dma_buf.o \
 	xe_engine.o \
+	xe_engine_class_sysfs.o \
 	xe_exec.o \
 	xe_execlist.o \
 	xe_force_wake.o \
drivers/gpu/drm/xe/xe_engine_class_sysfs.c new file +111 -0

111 lines not on this page · raw message

drivers/gpu/drm/xe/xe_engine_class_sysfs.h new file +13 -0
new file mode 100644
index 000000000000..f195dacc1ec6
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_ENGINE_CLASS_SYSFS_H_
+#define _XE_ENGINE_CLASS_SYSFS_H__
+
+#include "xe_gt.h"
+
+#define MAX_ENGINE_CLASS_NAME_LEN    16
+int xe_engine_class_sysfs_init(struct xe_gt *gt);
+#endif
drivers/gpu/drm/xe/xe_gt.c +7 -0
index a21d44bfe9e8..93929c8610c5 100644
@@ -14,6 +14,7 @@
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
+#include "xe_engine_class_sysfs.h"
 #include "xe_execlist.h"
 #include "xe_force_wake.h"
 #include "xe_ggtt.h"
@@ -322,6 +323,12 @@ static int gt_fw_domain_init(struct xe_gt *gt)
 	if (err)
 		goto err_force_wake;
 
+	err = xe_engine_class_sysfs_init(gt);
+	if (err)
+		drm_warn(&gt_to_xe(gt)->drm,
+			 "failed to register engines sysfs directory, err: %d\n",
+			 err);
+
 	err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
 	XE_WARN_ON(err);
 	xe_device_mem_access_put(gt_to_xe(gt));
Signature · 1 line
2.25.1
#2 lore raw

PATCH v4 2/6 drm/xe: Add sysfs for default engine scheduler properties

In reply to Tejas Upadhyay

For each HW engine under GT we are adding defaults sysfs entry to list all engine scheduler properties and its default values. So that it will be easier for user to fetch default values of these properties anytime to go back to default.

For example,
DUT# cat /sys/class/drm/card1/device/tileN/gtN/engines/bcs/.defaults/
job_timeout_ms preempt_timeout_us timeslice_duration_us

where,
@job_timeout_ms: The time after which a job is removed from the scheduler. @preempt_timeout_us: How long to wait (in microseconds) for a preemption
event to occur when submitting a new context.
@timeslice_duration_us: Each context is scheduled for execution for the
timeslice duration, before switching to the next context.

V3 :
- Rearrange code in its own file
- Rebase
- Update commit message to reflect tile addition
V2 :
- Use sysfs_create_files in this patch - Niranjana
- Handle prototype error for xe_add_engine_defaults - CI hooks
- Remove unused member sysfs_hwe - Niranjana

---
 drivers/gpu/drm/xe/xe_engine.c             |  4 +-
 drivers/gpu/drm/xe/xe_engine_class_sysfs.c | 94 ++++++++++++++++++++--
 drivers/gpu/drm/xe/xe_engine_class_sysfs.h | 20 +++++
 drivers/gpu/drm/xe/xe_guc_submit.c         |  5 +-
 drivers/gpu/drm/xe/xe_hw_engine.c          |  5 ++
 drivers/gpu/drm/xe/xe_hw_engine_types.h    | 12 +++
 6 files changed, 131 insertions(+), 9 deletions(-)
drivers/gpu/drm/xe/xe_engine.c +2 -2
index 59e0a9e085ba..aa2d49efb9bb 100644
@@ -54,8 +54,8 @@ static struct xe_engine *__xe_engine_create(struct xe_device *xe,
 	INIT_LIST_HEAD(&e->multi_gt_link);
 
 	/* FIXME: Wire up to configurable default value */
-	e->sched_props.timeslice_us = 1 * 1000;
-	e->sched_props.preempt_timeout_us = 640 * 1000;
+	e->sched_props.timeslice_us = hwe->sched_props.timeslice_us;
+	e->sched_props.preempt_timeout_us = hwe->sched_props.preempt_timeout_us;
 
 	if (xe_engine_is_parallel(e)) {
 		e->parallel.composite_fence_ctx = dma_fence_context_alloc(1);
drivers/gpu/drm/xe/xe_engine_class_sysfs.c +88 -6

129 lines not on this page · raw message

drivers/gpu/drm/xe/xe_engine_class_sysfs.h +20 -0
index f195dacc1ec6..492a84a22c30 100644
@@ -10,4 +10,24 @@
 
 #define MAX_ENGINE_CLASS_NAME_LEN    16
 int xe_engine_class_sysfs_init(struct xe_gt *gt);
+
+/**
+ * struct kobj_hwe - A hwe's kobject struct that connects the kobject and the
+ * hwe.
+ *
+ * When dealing with multiple hwe, this struct helps to understand which hwe
+ * needs to be addressed on a given sysfs call.
+ */
+struct kobj_hwe {
+	/** @base: The actual kobject */
+	struct kobject base;
+	/** @hwe: A pointer to the hwe itself */
+	struct xe_hw_engine *hwe;
+};
+
+static inline struct xe_hw_engine *kobj_to_hwe(struct kobject *kobj)
+{
+	return container_of(kobj, struct kobj_hwe, base)->hwe;
+}
+
 #endif
drivers/gpu/drm/xe/xe_guc_submit.c +4 -1
index 911d4965c27c..08e1b05206cc 100644
@@ -1128,7 +1128,8 @@ static int guc_engine_init(struct xe_engine *e)
 	ge->engine = e;
 	init_waitqueue_head(&ge->suspend_wait);
 
-	timeout = xe_vm_no_dma_fences(e->vm) ? MAX_SCHEDULE_TIMEOUT : HZ * 5;
+	timeout = xe_vm_no_dma_fences(e->vm) ? MAX_SCHEDULE_TIMEOUT :
+		  e->hwe->sched_props.job_timeout_ms;
 	err = drm_sched_init(&ge->sched, &drm_sched_ops, NULL,
 			     e->lrc[0].ring.size / MAX_JOB_SIZE_BYTES,
 			     64, timeout, guc_to_gt(guc)->ordered_wq, NULL,
@@ -1136,6 +1137,8 @@ static int guc_engine_init(struct xe_engine *e)
 			     gt_to_xe(e->gt)->drm.dev);
 	if (err)
 		goto err_free;
+	/* Record timeout value, in order to show current set timeout */
+	e->hwe->sched_props.job_timeout_ms = timeout;
 
 	sched = &ge->sched;
 	err = drm_sched_entity_init(&ge->entity, DRM_SCHED_PRIORITY_NORMAL,
drivers/gpu/drm/xe/xe_hw_engine.c +5 -0
index 1af5cccd1142..0a254a59735d 100644
@@ -361,6 +361,11 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,
 	hwe->name = info->name;
 	hwe->fence_irq = &gt->fence_irq[info->class];
 	hwe->engine_id = id;
+	/* FIXME: Wire up to configurable default value */
+	hwe->sched_props.job_timeout_ms = HZ * 5;
+	hwe->sched_props.timeslice_us = 1 * 1000;
+	hwe->sched_props.preempt_timeout_us = 640 * 1000;
+	hwe->defaults = hwe->sched_props; /* Record default props */
 
 	xe_reg_sr_init(&hwe->reg_sr, hwe->name, gt_to_xe(gt));
 	xe_wa_process_engine(hwe);
drivers/gpu/drm/xe/xe_hw_engine_types.h +12 -0
index d788e67312b9..6635c36f38d0 100644
@@ -107,6 +107,18 @@ struct xe_hw_engine {
 	void (*irq_handler)(struct xe_hw_engine *, u16);
 	/** @engine_id: id  for this hw engine */
 	enum xe_hw_engine_id engine_id;
+	/**
+	 * @sched_props: scheduling properties
+	 * @defaults: default scheduling properties
+	 */
+	struct {
+		/** @set_job_timeout: Set job timeout in ms for engine */
+		u32 job_timeout_ms;
+		/** @timeslice_us: timeslice period in micro-seconds */
+		u32 timeslice_us;
+		/** @preempt_timeout_us: preemption timeout in micro-seconds */
+		u32 preempt_timeout_us;
+	} sched_props, defaults;
 };
 
 /**
Signature · 1 line
2.25.1
#3 lore raw

PATCH v4 3/6 drm/xe: Add job timeout engine property to sysfs

In reply to Tejas Upadhyay

The time after which a job is removed from the scheduler. Add sysfs entry to provide user defined job timeout to scheduler.

The job timeout can be adjusted per-engine class using,

/sys/class/drm/cardX/device/tileN/gtN/engines/ccs/job_timeout_ms

V3:
- Rebase
- Update commit message to reflect tile update
V2:
- Use sysfs_create_files as part of this patch

---
 drivers/gpu/drm/xe/xe_engine_class_sysfs.c | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/gpu/drm/xe/xe_engine_class_sysfs.c +42 -0
index 7804cc27bd05..7f4ecef4ef81 100644
@@ -39,6 +39,37 @@ kobj_xe_engine(struct kobject *parent, char *name)
 	return khwe;
 }
 
+static ssize_t job_timeout_store(struct kobject *kobj,
+				 struct kobj_attribute *attr,
+				 const char *buf, size_t count)
+{
+	struct xe_hw_engine *hwe = kobj_to_hwe(kobj);
+	u32 timeout;
+	int err;
+
+	err = kstrtou32(buf, 0, &timeout);
+	if (err)
+		return err;
+
+	if (timeout > jiffies_to_usecs(MAX_SCHEDULE_TIMEOUT))
+		return -EINVAL;
+
+	WRITE_ONCE(hwe->sched_props.job_timeout_ms, timeout);
+
+	return count;
+}
+
+static ssize_t job_timeout_show(struct kobject *kobj,
+				struct kobj_attribute *attr, char *buf)
+{
+	struct xe_hw_engine *hwe = kobj_to_hwe(kobj);
+
+	return sprintf(buf, "%u\n", hwe->sched_props.job_timeout_ms);
+}
+
+static struct kobj_attribute job_timeout_attr =
+__ATTR(job_timeout_ms, 0644, job_timeout_show, job_timeout_store);
+
 static ssize_t job_timeout_default(struct kobject *kobj,
 				   struct kobj_attribute *attr, char *buf)
 {
@@ -80,6 +111,11 @@ static const struct attribute *defaults[] = {
 	NULL
 };
 
+static const struct attribute *files[] = {
+	&job_timeout_attr.attr,
+	NULL
+};
+
 static int xe_add_engine_class_defaults(struct kobject *parent)
 {
 	struct kobject *kobj;
@@ -188,6 +224,12 @@ int xe_engine_class_sysfs_init(struct xe_gt *gt)
 			return err;
 		}
 
+		err = sysfs_create_files(&khwe->base, files);
+		if (err) {
+			kobject_put(kobj);
+			return err;
+		}
 	}
+
 	return err;
 }
Signature · 1 line
2.25.1
#4 lore raw

PATCH v4 4/6 drm/xe: Add timeslice duration engine property to sysfs

In reply to Tejas Upadhyay

Timeslices between multiple context is supported via guc scheduling. Add sysfs entry to provide user defined timeslice duration to guc scheduling.

The timeslice duration can be adjusted per-engine class using,

/sys/class/drm/cardX/device/tileN/gtN/engines/ccs/timeslice_duration_us

V3:
- Rebase
- Update commit messge to add tile
V2:
- Rebase

---
 drivers/gpu/drm/xe/xe_engine_class_sysfs.c | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
drivers/gpu/drm/xe/xe_engine_class_sysfs.c +33 -0
index 7f4ecef4ef81..7d2688bb5cee 100644
@@ -81,6 +81,38 @@ static ssize_t job_timeout_default(struct kobject *kobj,
 static struct kobj_attribute job_timeout_def =
 __ATTR(job_timeout_ms, 0444, job_timeout_default, NULL);
 
+static ssize_t timeslice_duration_store(struct kobject *kobj,
+					struct kobj_attribute *attr,
+					const char *buf, size_t count)
+{
+	struct xe_hw_engine *hwe = kobj_to_hwe(kobj);
+	u32 duration;
+	int err;
+
+	err = kstrtou32(buf, 0, &duration);
+	if (err)
+		return err;
+
+	if (duration > jiffies_to_usecs(MAX_SCHEDULE_TIMEOUT))
+		return -EINVAL;
+
+	WRITE_ONCE(hwe->sched_props.timeslice_us, duration);
+
+	return count;
+}
+
+static ssize_t timeslice_duration_show(struct kobject *kobj,
+		struct kobj_attribute *attr, char *buf)
+{
+	struct xe_hw_engine *hwe = kobj_to_hwe(kobj);
+
+	return sprintf(buf, "%u\n", hwe->sched_props.timeslice_us);
+}
+
+static struct kobj_attribute timeslice_duration_attr =
+	__ATTR(timeslice_duration_us, 0644, timeslice_duration_show, 
+	       timeslice_duration_store);
+
 static ssize_t timeslice_default(struct kobject *kobj,
 				 struct kobj_attribute *attr, char *buf)
 {
@@ -113,6 +145,7 @@ static const struct attribute *defaults[] = {
 
 static const struct attribute *files[] = {
 	&job_timeout_attr.attr,
+	&timeslice_duration_attr.attr,
 	NULL
 };
 
Signature · 1 line
2.25.1
#5 lore raw

PATCH v4 5/6 drm/xe: Add sysfs for preempt reset timeout

In reply to Tejas Upadhyay

The preemption request and timeout is used for higher priority context or kill hung context and reset gpu.

The preempt timeout can be adjusted per-engine class using,

/sys/class/drm/cardX/device/tileN/gtN/engines/ccs/preempt_timeout_us

and can be disabled by setting it to 0.

V2:
- Rebase
- Update commit message to add tile

---
 drivers/gpu/drm/xe/xe_engine_class_sysfs.c | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
drivers/gpu/drm/xe/xe_engine_class_sysfs.c +32 -0
index 7d2688bb5cee..8350f7441af6 100644
@@ -124,6 +124,37 @@ static ssize_t timeslice_default(struct kobject *kobj,
 static struct kobj_attribute timeslice_duration_def =
 __ATTR(timeslice_duration_us, 0444, timeslice_default, NULL);
 
+static ssize_t preempt_timeout_store(struct kobject *kobj,
+				     struct kobj_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct xe_hw_engine *hwe = kobj_to_hwe(kobj);
+	u32 timeout;
+	int err;
+
+	err = kstrtou32(buf, 0, &timeout);
+	if (err)
+		return err;
+
+	if (timeout > jiffies_to_usecs(MAX_SCHEDULE_TIMEOUT))
+		return -EINVAL;
+
+	WRITE_ONCE(hwe->sched_props.preempt_timeout_us, timeout);
+
+	return count;
+}
+
+static ssize_t preempt_timeout_show(struct kobject *kobj,
+				    struct kobj_attribute *attr, char *buf)
+{
+	struct xe_hw_engine *hwe = kobj_to_hwe(kobj);
+
+	return sprintf(buf, "%u\n", hwe->sched_props.preempt_timeout_us);
+}
+
+static struct kobj_attribute preempt_timeout_attr =
+__ATTR(preempt_timeout_us, 0644, preempt_timeout_show, preempt_timeout_store);
+
 static ssize_t preempt_timeout_default(struct kobject *kobj,
 				       struct kobj_attribute *attr,
 				       char *buf)
@@ -146,6 +177,7 @@ static const struct attribute *defaults[] = {
 static const struct attribute *files[] = {
 	&job_timeout_attr.attr,
 	&timeslice_duration_attr.attr,
+	&preempt_timeout_attr.attr,
 	NULL
 };
 
Signature · 1 line
2.25.1
#6 lore raw

PATCH v4 6/6 drm/xe: Add min/max cap for engine scheduler properties

In reply to Tejas Upadhyay

Add sysfs entries for the min, max, and defaults for each of engine scheduler controls for every hardware engine class.

Non-elevated user IOCTLs to set these controls must be within the min-max ranges of the sysfs entries, elevated user can set these controls to any value. However, introduced compile time CONFIG min-max values which restricts elevated user to be in compile time min-max range if at all sysfs min/max are violated.

Sysfs entries examples are,
DUT# cat /sys/class/drm/cardX/device/tileN/gtN/engines/ccs/.defaults/

job_timeout_max         job_timeout_ms          preempt_timeout_min     timeslice_duration_max  timeslice_duration_us
job_timeout_min         preempt_timeout_max     preempt_timeout_us      timeslice_duration_min

DUT# cat /sys/class/drm/card1/device/tileN/gtN/engines/ccs/

.defaults/              job_timeout_min         preempt_timeout_max     preempt_timeout_us      timeslice_duration_min
job_timeout_max         job_timeout_ms          preempt_timeout_min     timeslice_duration_max  timeslice_duration_us

V4 :
- Rebase
- Update commit to reflect tile addition
- Use XE_HW macro directly as they are already filtered for CONFIG checks - Niranjana
- Add CONFIG for enable/disable min/max limitation on elevated user. Default is enable - Matt/Joonas
V3 :
- Resolve CI hooks warning for kernel-doc
V2 :
- Restric min/max setting to #define default min/max for elevated user - Himal
- Remove unrelated changes from patch - Niranjana

---
 drivers/gpu/drm/xe/Kconfig                 |   7 +
 drivers/gpu/drm/xe/Kconfig.profile         |  45 +++
 drivers/gpu/drm/xe/xe_engine.c             |  43 ++-
 drivers/gpu/drm/xe/xe_engine_class_sysfs.c | 392 ++++++++++++++++++++-
 drivers/gpu/drm/xe/xe_engine_class_sysfs.h |   1 +
 drivers/gpu/drm/xe/xe_hw_engine.c          |   6 +
 drivers/gpu/drm/xe/xe_hw_engine.h          |  31 ++
 drivers/gpu/drm/xe/xe_hw_engine_types.h    |  12 +
 8 files changed, 530 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/Kconfig.profile
drivers/gpu/drm/xe/Kconfig +7 -0
index b739faa401d3..fd48be7a2812 100644
@@ -84,3 +84,10 @@ depends on DRM_XE
 depends on EXPERT
 source "drivers/gpu/drm/xe/Kconfig.debug"
 endmenu
+
+menu "drm/xe Profile Guided Optimisation"
+	visible if EXPERT
+	depends on DRM_XE
+	source "drivers/gpu/drm/xe/Kconfig.profile"
+endmenu
+
drivers/gpu/drm/xe/Kconfig.profile new file +45 -0

45 lines not on this page · raw message

drivers/gpu/drm/xe/xe_engine.c +40 -3

71 lines not on this page · raw message

drivers/gpu/drm/xe/xe_engine_class_sysfs.c +388 -4

466 lines not on this page · raw message

drivers/gpu/drm/xe/xe_engine_class_sysfs.h +1 -0
index 492a84a22c30..7b4ae8b726a3 100644
@@ -10,6 +10,7 @@
 
 #define MAX_ENGINE_CLASS_NAME_LEN    16
 int xe_engine_class_sysfs_init(struct xe_gt *gt);
+bool engine_timeout_in_range(u64 timeout, u64 min, u64 max);
 
 /**
  * struct kobj_hwe - A hwe's kobject struct that connects the kobject and the
drivers/gpu/drm/xe/xe_hw_engine.c +6 -0
index 0a254a59735d..2951fa999520 100644
@@ -363,8 +363,14 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,
 	hwe->engine_id = id;
 	/* FIXME: Wire up to configurable default value */
 	hwe->sched_props.job_timeout_ms = HZ * 5;
+	hwe->sched_props.job_timeout_min = XE_HW_ENGINE_JOB_TIMEOUT_MIN;
+	hwe->sched_props.job_timeout_max = XE_HW_ENGINE_JOB_TIMEOUT_MAX;
 	hwe->sched_props.timeslice_us = 1 * 1000;
+	hwe->sched_props.timeslice_min = XE_HW_ENGINE_TIMESLICE_MIN;
+	hwe->sched_props.timeslice_max = XE_HW_ENGINE_TIMESLICE_MAX;
 	hwe->sched_props.preempt_timeout_us = 640 * 1000;
+	hwe->sched_props.preempt_timeout_min = XE_HW_ENGINE_PREEMPT_TIMEOUT_MIN;
+	hwe->sched_props.preempt_timeout_max = XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX;
 	hwe->defaults = hwe->sched_props; /* Record default props */
 
 	xe_reg_sr_init(&hwe->reg_sr, hwe->name, gt_to_xe(gt));
drivers/gpu/drm/xe/xe_hw_engine.h +31 -0
index 7eca9d53c7b1..3d37d6d44261 100644
@@ -10,6 +10,37 @@
 
 struct drm_printer;
 
+#ifdef CONFIG_DRM_XE_JOB_TIMEOUT_MIN
+#define XE_HW_ENGINE_JOB_TIMEOUT_MIN CONFIG_DRM_XE_JOB_TIMEOUT_MIN
+#else
+#define XE_HW_ENGINE_JOB_TIMEOUT_MIN 1
+#endif
+#ifdef CONFIG_DRM_XE_JOB_TIMEOUT_MAX
+#define XE_HW_ENGINE_JOB_TIMEOUT_MAX CONFIG_DRM_XE_JOB_TIMEOUT_MAX
+#else
+#define XE_HW_ENGINE_JOB_TIMEOUT_MAX (10 * 1000)
+#endif
+#ifdef CONFIG_DRM_XE_TIMESLICE_MIN
+#define XE_HW_ENGINE_TIMESLICE_MIN CONFIG_DRM_XE_TIMESLICE_MIN
+#else
+#define XE_HW_ENGINE_TIMESLICE_MIN 1
+#endif
+#ifdef CONFIG_DRM_XE_TIMESLICE_MAX
+#define XE_HW_ENGINE_TIMESLICE_MAX CONFIG_DRM_XE_TIMESLICE_MAX
+#else
+#define XE_HW_ENGINE_TIMESLICE_MAX (10 * 1000 * 1000)
+#endif
+#ifdef CONFIG_DRM_XE_PREEMPT_TIMEOUT_MIN
+#define XE_HW_ENGINE_PREEMPT_TIMEOUT_MIN CONFIG_DRM_XE_PREEMPT_TIMEOUT_MIN
+#else
+#define XE_HW_ENGINE_PREEMPT_TIMEOUT_MIN 1
+#endif
+#ifdef CONFIG_DRM_XE_PREEMPT_TIMEOUT_MAX
+#define XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX CONFIG_DRM_XE_PREEMPT_TIMEOUT_MAX
+#else
+#define XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX (10 * 1000 * 1000)
+#endif
+
 int xe_hw_engines_init_early(struct xe_gt *gt);
 int xe_hw_engines_init(struct xe_gt *gt);
 void xe_hw_engine_handle_irq(struct xe_hw_engine *hwe, u16 intr_vec);
drivers/gpu/drm/xe/xe_hw_engine_types.h +12 -0
index 6635c36f38d0..404556f69126 100644
@@ -114,10 +114,22 @@ struct xe_hw_engine {
 	struct {
 		/** @set_job_timeout: Set job timeout in ms for engine */
 		u32 job_timeout_ms;
+		/** @job_timeout_min: Min job timeout in ms for engine */
+		u32 job_timeout_min;
+		/** @job_timeout_max: Max job timeout in ms for engine */
+		u32 job_timeout_max;
 		/** @timeslice_us: timeslice period in micro-seconds */
 		u32 timeslice_us;
+		/** @timeslice_min: min timeslice period in micro-seconds */
+		u32 timeslice_min;
+		/** @timeslice_max: max timeslice period in micro-seconds */
+		u32 timeslice_max;
 		/** @preempt_timeout_us: preemption timeout in micro-seconds */
 		u32 preempt_timeout_us;
+		/** @preempt_timeout_min: min preemption timeout in micro-seconds */
+		u32 preempt_timeout_min;
+		/** @preempt_timeout_max: max preemption timeout in micro-seconds */
+		u32 preempt_timeout_max;
 	} sched_props, defaults;
 };
 
Signature · 1 line
2.25.1
#7 lore raw

[Intel-xe] ✗ CI.Patch_applied: failure for drm/xe: Add engine scheduler control interface (rev4)

In reply to Tejas Upadhyay
== Series Details ==

== Series Details ==

Series: drm/xe: Add engine scheduler control interface (rev4)
URL : https://patchwork.freedesktop.org/series/119392/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: a3ce80bf0 fixup! drm/xe: Rely on kmalloc/kzalloc log message === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/Makefile:51
error: drivers/gpu/drm/xe/Makefile: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe: Add sysfs entries for engines under its GT Patch failed at 0001 drm/xe: Add sysfs entries for engines under its GT When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".