[PATCH i-g-t] tests/intel/xe_drm_fdinfo: Add test to check for active contexts

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


On Tue, May 20, 2025 at 04:12:30PM -0500, Lucas De Marchi wrote:
>On Fri, May 16, 2025 at 10:49:37AM +0530, Riana Tauro wrote:
>>Hi Umesh
>>
>>On 4/26/2025 12:51 AM, Umesh Nerlige Ramappa wrote:
>>>Add a test to check if fdinfo returns the correct ticks when querying
>>>utilization for a context that is currently active on the engine.
>>>
>>>Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
>>>---
>>> tests/intel/xe_drm_fdinfo.c | 12 ++++++++++++
>>> 1 file changed, 12 insertions(+)
>>>
>>>diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
>>>index 9a8811b4cd2f..73346ee9b1da 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-active-full-load
>>>+ * Description: Check that each engine shows full load when active
>>>+ *
>>>  * SUBTEST: utilization-single-full-load-isolation
>>>  * Description: Check that each engine load does not spill over to other drm clients
>>>  *
>>>@@ -456,6 +459,9 @@ utilization_single(int fd, struct drm_xe_engine_class_instance *hwe, unsigned in
>>> 	if (flags & TEST_ISOLATION)
>>> 		read_engine_cycles(new_fd, pceu2[1]);
>>>+	if (cork && !cork->ended)
>>>+		xe_cork_sync_end(fd, cork);
>
>wouldn't it be better to add a flag to be explicit about the test
>behavior?

TEST_TRAILING_IDLE is the explicit flag. The only difference is that the 
active utilization implementation came in later. Otherwise the active 
utilization was supposed to be the default.

>
>right now we have the following combinations:
>
>	- 0
>	- TEST_BUSY | TEST_TRAILING_IDLE
>	- TEST_BUSY | TEST_TRAILING_IDLE | TEST_ISOLATION
>
>TEST_TRAILING_IDLE is kind of pointless right now as it's actually tied
>to TEST_BUSY. Doesn't make sense without it, does it? So yeah, maybe
>drop the TEST_TRAILING_IDLE flag and add one for this.

I posted these changes here - 
https://patchwork.freedesktop.org/series/149290/

but not seeing a whole lot of benefit from dropping TEST_TRAILING_IDLE 
and replacing it with TEST_WHILE_ACTIVE (if that's what you meant).

>
>I'd call it utilization-single-full-load-while-active. And update the
>doc on top of the function to differentiate them.

I changed the name in the above series, but not sure what 
documentation's needed on top of the function. Do you mean add some 
explanation about the flags?

Thanks,
Umesh
>
>Lucas De Marchi
>
>>>+
>>> 	expected_load = flags & TEST_BUSY ?
>>> 	       EXPECTED_LOAD_FULL : EXPECTED_LOAD_IDLE;
>>>@@ -769,6 +775,12 @@ igt_main
>>> 			utilization_single(xe, hwe, 0);
>>> 	}
>>>+	igt_subtest("utilization-single-active-full-load") {
>>>+		require_engine_utilization_data(xe);
>>>+		xe_for_each_engine(xe, hwe)
>>>+			utilization_single(xe, hwe, TEST_BUSY);
>>>+	}
>>>+
>>the trailing test can be renamed to load-idle and this to full load
>>
>>Test looks good to me
>>
>>Reviewed-by: Riana Tauro <riana.tauro at intel.com>
>>
>>> 	igt_subtest("utilization-single-full-load") {
>>> 		require_engine_utilization_data(xe);
>>> 		xe_for_each_engine(xe, hwe)


More information about the igt-dev mailing list