[PATCH v2] tests/intel/xe_exec_reset: Explicitly declare exec

Nirmoy Das nirmoy.das at linux.intel.com
Tue Oct 15 07:50:10 UTC 2024


On 10/15/2024 12:00 AM, Jonathan Cavitt wrote:
> In the gt-reset-stress subtest, we define a drm_xe_exec exec without
> declaring any of its variable values.  We then define some of the struct
> values separately later in execution.  Instead of doing this, we should
> explicitly declare exec to equal a new struct with the assigned values
> initialized during construction.  This prevents any values from being
> assigned garbage data during execution.
>
> v2: Define assigned variables as a part of declaration, rather than
> separately later during exeuction. (Dixit)
>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
> CC: Jani Saarinen <jani.saarinen at intel.com>
> CC: Ashutosh Dixit <ashutosh.dixit at intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das at intel.com>
> ---
>  tests/intel/xe_exec_reset.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tests/intel/xe_exec_reset.c b/tests/intel/xe_exec_reset.c
> index b5d5f43eab..43ef1e3345 100644
> --- a/tests/intel/xe_exec_reset.c
> +++ b/tests/intel/xe_exec_reset.c
> @@ -628,7 +628,10 @@ static void submit_jobs(struct gt_thread_data *t)
>  			.engine_instance = 0,
>  			.gt_id = 0,
>  		};
> -		struct drm_xe_exec exec;
> +		struct drm_xe_exec exec = {
> +			.address = addr,
> +			.num_batch_buffer = 1,
> +		};
>  		int ret;
>  
>  		/* GuC IDs can get exhausted */
> @@ -636,8 +639,6 @@ static void submit_jobs(struct gt_thread_data *t)
>  		if (ret)
>  			continue;
>  
> -		exec.address = addr;
> -		exec.num_batch_buffer = 1;
>  		xe_exec(fd, &exec);
>  		xe_exec_queue_destroy(fd, exec.exec_queue_id);
>  	}


More information about the igt-dev mailing list