[PATCH] tests/intel/xe_drm_fdinfo: Do not end NULL xe_cork

Jonathan Cavitt jonathan.cavitt at intel.com
Thu Jan 2 16:25:40 UTC 2025


An earlier commit prevented the execution of the xe_cork_destroy
function when the xe_cork is not initialized via xe_cork_create in
xe_drm_fdinfo.  This must also be done with the xe_cork_sync_end
function in some places.

Fixes: 2feb1d67 ("lib/xe/xe_spin: move the spinner related functions to lib")
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3869
CC: Pravalika Gurram <pravalika.gurram at intel.com>
CC: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
CC: Daniel Stenka <daniel.stenka at intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
---
 tests/intel/xe_drm_fdinfo.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
index e83c55c646..0d1cbfe59e 100644
--- a/tests/intel/xe_drm_fdinfo.c
+++ b/tests/intel/xe_drm_fdinfo.c
@@ -532,8 +532,11 @@ utilization_others_full_load(int fd, struct drm_xe_engine_class_instance *hwe)
 
 	read_engine_cycles(fd, pceu1);
 	usleep(batch_duration_usec);
-	xe_for_each_engine_class(class)
-		xe_cork_sync_end(fd, ctx[class]);
+	xe_for_each_engine_class(class) {
+		if (ctx[class])
+			xe_cork_sync_end(fd, ctx[class]);
+	}
+
 	read_engine_cycles(fd, pceu2);
 
 	xe_for_each_engine_class(class) {
@@ -573,8 +576,11 @@ utilization_all_full_load(int fd)
 
 	read_engine_cycles(fd, pceu1);
 	usleep(batch_duration_usec);
-	xe_for_each_engine_class(class)
-		xe_cork_sync_end(fd, ctx[class]);
+	xe_for_each_engine_class(class) {
+		if (ctx[class])
+			xe_cork_sync_end(fd, ctx[class]);
+	}
+
 	read_engine_cycles(fd, pceu2);
 
 	xe_for_each_engine_class(class) {
-- 
2.43.0



More information about the igt-dev mailing list