[Intel-xe] [PATCH 1/4] drm/xe: Simplify engine class sched_props setting

Upadhyay, Tejas tejas.upadhyay at intel.com
Sat Aug 12 06:42:22 UTC 2023



> -----Original Message-----
> From: Vishwanathapura, Niranjana <niranjana.vishwanathapura at intel.com>
> Sent: Tuesday, August 8, 2023 11:54 PM
> To: intel-xe at lists.freedesktop.org
> Cc: Harrison, John C <john.c.harrison at intel.com>; Upadhyay, Tejas
> <tejas.upadhyay at intel.com>
> Subject: [PATCH 1/4] drm/xe: Simplify engine class sched_props setting
> 
> Shortens the too long code lines.
> 
> Fixes: ccafbcc61fa5 ("drm/xe: Add min/max cap for engine scheduler
> properties")
> Fixes: ef811a09e28b ("drm/xe: Add sysfs for default engine scheduler
> properties")
> Signed-off-by: Niranjana Vishwanathapura
> <niranjana.vishwanathapura at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_hw_engine.c | 26 ++++++++++++--------------
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c
> b/drivers/gpu/drm/xe/xe_hw_engine.c
> index b8fcc6e985cf..c44540684462 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine.c
> @@ -362,22 +362,20 @@ static void hw_engine_init_early(struct xe_gt *gt,
> struct xe_hw_engine *hwe,
>  	hwe->fence_irq = &gt->fence_irq[info->class];
>  	hwe->engine_id = id;
> 
> -	if (!gt->eclass[hwe->class].sched_props.job_timeout_ms) {
> -		gt->eclass[hwe->class].sched_props.job_timeout_ms = 5 *
> 1000;
> -		gt->eclass[hwe->class].sched_props.job_timeout_min =
> XE_HW_ENGINE_JOB_TIMEOUT_MIN;
> -		gt->eclass[hwe->class].sched_props.job_timeout_max =
> XE_HW_ENGINE_JOB_TIMEOUT_MAX;
> -		gt->eclass[hwe->class].sched_props.timeslice_us = 1 * 1000;
> -		gt->eclass[hwe->class].sched_props.timeslice_min =
> XE_HW_ENGINE_TIMESLICE_MIN;
> -		gt->eclass[hwe->class].sched_props.timeslice_max =
> XE_HW_ENGINE_TIMESLICE_MAX;
> -		gt->eclass[hwe->class].sched_props.preempt_timeout_us =
> 640 * 1000;
> -		gt->eclass[hwe->class].sched_props.preempt_timeout_min =
> -
> 	XE_HW_ENGINE_PREEMPT_TIMEOUT_MIN;
> -		gt->eclass[hwe->class].sched_props.preempt_timeout_max =
> -
> 	XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX;
> +	hwe->eclass = &gt->eclass[hwe->class];
> +	if (!hwe->eclass->sched_props.job_timeout_ms) {
> +		hwe->eclass->sched_props.job_timeout_ms = 5 * 1000;
> +		hwe->eclass->sched_props.job_timeout_min =
> XE_HW_ENGINE_JOB_TIMEOUT_MIN;
> +		hwe->eclass->sched_props.job_timeout_max =
> XE_HW_ENGINE_JOB_TIMEOUT_MAX;
> +		hwe->eclass->sched_props.timeslice_us = 1 * 1000;
> +		hwe->eclass->sched_props.timeslice_min =
> XE_HW_ENGINE_TIMESLICE_MIN;
> +		hwe->eclass->sched_props.timeslice_max =
> XE_HW_ENGINE_TIMESLICE_MAX;
> +		hwe->eclass->sched_props.preempt_timeout_us = 640 *
> 1000;
> +		hwe->eclass->sched_props.preempt_timeout_min =
> XE_HW_ENGINE_PREEMPT_TIMEOUT_MIN;
> +		hwe->eclass->sched_props.preempt_timeout_max =
> XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX;
>  		/* Record default props */
> -		gt->eclass[hwe->class].defaults = gt->eclass[hwe-
> >class].sched_props;
> +		hwe->eclass->defaults = hwe->eclass->sched_props;
>  	}
> -	hwe->eclass = &gt->eclass[hwe->class];
> 
>  	xe_reg_sr_init(&hwe->reg_sr, hwe->name, gt_to_xe(gt));
>  	xe_wa_process_engine(hwe);
> --

Looks ok to me, it helps reducing some letters of code line.
Reviewed-by: Tejas Upadhyay <tejas.upadhyay at intel.com>

> 2.21.0.rc0.32.g243a4c7e27



More information about the Intel-xe mailing list