Skip to contentSkip to conversation

tests/intel/xe_exec_reset: Explicitly declare exec

PATCH Superseded Jonathan Cavitt 2 participants 3 messages Oct 14, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/intel/xe_exec_reset: Explicitly declare exec

In the gt-reset-stress subtest, we define a drm_xe_exec exec without declaring any of its variable values. Explicitly declare exec to equal an empty struct to prevent any values from being assigned garbage data during execution.

---
 tests/intel/xe_exec_reset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/intel/xe_exec_reset.c +1 -1
index b5d5f43eab..fdfefa91cc 100644
@@ -628,7 +628,7 @@ 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 = {};
 		int ret;
 
 		/* GuC IDs can get exhausted */
Signature · 1 line
2.43.0
#1 lore raw

tests/intel/xe_exec_reset.c static void submit_jobs(struct gt_thread_data *t) · line 633

Quoted 13 lines · Jonathan Cavitt
tests/intel/xe_exec_reset.c +1 -1
index b5d5f43eab..fdfefa91cc 100644
@@ -628,7 +628,7 @@ 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 = {};
 		int ret;
 

How about

      struct drm_xe_exec exec = {
                .num_batch_buffer = 1,
                .address = addr,
        };

And delete the assignments below?

Quoted 4 lines
tests/intel/xe_exec_reset.c +0 -1
 		/* GuC IDs can get exhausted */
--

2.43.0

#2 lore raw

-----Original Message-----
From: Dixit, Ashutosh <[email protected]>
Sent: Monday, October 14, 2024 2:46 PM
To: Cavitt, Jonathan <[email protected]>
Cc: [email protected]; Gupta, saurabhg <[email protected]>; Zuo, Alex <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH] tests/intel/xe_exec_reset: Explicitly declare exec

Quoted 18 lines · Jonathan Cavitt

tests/intel/xe_exec_reset.c static void submit_jobs(struct gt_thread_data *t) · line 633

Quoted 13 lines
tests/intel/xe_exec_reset.c +1 -1
index b5d5f43eab..fdfefa91cc 100644
@@ -628,7 +628,7 @@ 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 = {};
 		int ret;
 

How about

Quoted 6 lines
      struct drm_xe_exec exec = {
                .num_batch_buffer = 1,
                .address = addr,
        };

And delete the assignments below?

Good catch!
I'll apply this change shortly and change the commit message to reflect the new implementation.
-Jonathan Cavitt

Quoted 6 lines
Quoted 5 lines
tests/intel/xe_exec_reset.c +0 -1
 		/* GuC IDs can get exhausted */
--

2.43.0