[Intel-xe] [PATCH V5 5/6] drm/xe: Add sysfs for preempt reset timeout
Matthew Brost
matthew.brost at intel.com
Thu Jul 20 19:36:46 UTC 2023
On Thu, Jul 20, 2023 at 07:55:09PM +0530, Tejas Upadhyay wrote:
> 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
>
> Signed-off-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
> ---
> drivers/gpu/drm/xe/xe_engine_class_sysfs.c | 32 ++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_engine_class_sysfs.c b/drivers/gpu/drm/xe/xe_engine_class_sysfs.c
> index 7d2688bb5cee..8350f7441af6 100644
> --- a/drivers/gpu/drm/xe/xe_engine_class_sysfs.c
> +++ b/drivers/gpu/drm/xe/xe_engine_class_sysfs.c
> @@ -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))
Same as previous patch, MAX_SCHEDULE_TIMEOUT here isn't correct.
Matt
> + 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,
> ×lice_duration_attr.attr,
> + &preempt_timeout_attr.attr,
> NULL
> };
>
> --
> 2.25.1
>
More information about the Intel-xe
mailing list