[PATCH i-g-t 4/4] tests/intel/xe_drm_fdinfo: Test utilization while load is active

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Tue May 20 23:20:32 UTC 2025


Add a test to check if fdinfo returns the correct ticks when querying
utilization for a context that is currently active on the engine.

v2: Use a specific flag for this test (Lucas)

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
Reviewed-by: Riana Tauro <riana.tauro at intel.com>
---
 tests/intel/xe_drm_fdinfo.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
index ec439ce7a6d2..ad7b45b1789c 100644
--- a/tests/intel/xe_drm_fdinfo.c
+++ b/tests/intel/xe_drm_fdinfo.c
@@ -48,6 +48,9 @@
  * SUBTEST: utilization-single-full-load
  * Description: Check that each engine shows full load
  *
+ * SUBTEST: utilization-single-full-load-while-active
+ * Description: Check that each engine shows full load whle active
+ *
  * SUBTEST: utilization-single-full-load-isolation
  * Description: Check that each engine load does not spill over to other drm clients
  *
@@ -70,6 +73,7 @@ IGT_TEST_DESCRIPTION("Read and verify drm client memory consumption and engine u
 
 /* flag masks */
 #define TEST_WITH_LOAD		(1 << 0)
+#define TEST_WHILE_ACTIVE	(1 << 0)
 #define TEST_ISOLATION		(1 << 2)
 #define TEST_VIRTUAL		(1 << 3)
 #define TEST_PARALLEL		(1 << 4)
@@ -454,12 +458,15 @@ utilization_single(int fd, struct drm_xe_engine_class_instance *hwe, unsigned in
 		read_engine_cycles(new_fd, pceu1[1]);
 
 	usleep(batch_duration_usec);
-	end_cork(fd, cork);
+	if (!(flags & TEST_WHILE_ACTIVE))
+		end_cork(fd, cork);
 
 	read_engine_cycles(fd, pceu2[0]);
 	if (flags & TEST_ISOLATION)
 		read_engine_cycles(new_fd, pceu2[1]);
 
+	end_cork(fd, cork);
+
 	expected_load = flags & TEST_WITH_LOAD ?
 	       EXPECTED_LOAD_FULL : EXPECTED_LOAD_IDLE;
 
@@ -691,7 +698,8 @@ utilization_multi(int fd, int gt, int class, unsigned int flags)
 		read_engine_cycles(fd_spill, pceu_spill[0]);
 
 	usleep(batch_duration_usec);
-	end_cork(fd, cork);
+	if (!(flags & TEST_WHILE_ACTIVE))
+		end_cork(fd, cork);
 
 	read_engine_cycles(fd, pceu[1]);
 	if (flags & TEST_ISOLATION)
@@ -768,6 +776,13 @@ igt_main
 			utilization_single(xe, hwe, 0);
 	}
 
+	igt_subtest("utilization-single-full-load-while-active") {
+		require_engine_utilization_data(xe);
+		xe_for_each_engine(xe, hwe)
+			utilization_single(xe, hwe,
+					   TEST_WITH_LOAD | TEST_WHILE_ACTIVE);
+	}
+
 	igt_subtest("utilization-single-full-load") {
 		require_engine_utilization_data(xe);
 		xe_for_each_engine(xe, hwe)
-- 
2.43.0



More information about the igt-dev mailing list