[PATCH i-g-t v2 10/10] tests/intel/xe_drm_fdinfo: Ensure queue destroy records load correctly
Umesh Nerlige Ramappa
umesh.nerlige.ramappa at intel.com
Wed Jul 3 00:25:32 UTC 2024
If the exec queue is destroyed before recording the utilization, make
sure the load is correctly captured.
v2:
- s/measured_usleep/usleep
- remove xe_ prefix from helpers/structures
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
---
tests/intel/xe_drm_fdinfo.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
index f1e06991c..b3c865757 100644
--- a/tests/intel/xe_drm_fdinfo.c
+++ b/tests/intel/xe_drm_fdinfo.c
@@ -70,6 +70,9 @@
* SUBTEST: drm-parallel-busy-idle-isolation
* Description: Check that parallel engine load does not spill over to other drm clients
*
+ * SUBTEST: drm-busy-exec-queue-destroy-idle
+ * Description: Destroy exec queue before idle and ensure load is accurate
+ *
* SUBTEST: drm-total-resident
* Description: Create and compare total and resident memory consumption by client
*
@@ -567,6 +570,32 @@ check_results(struct pceu_cycles *s1, struct pceu_cycles *s2,
igt_assert(!percent);
}
+static void
+single_destroy_queue(int fd, struct drm_xe_engine_class_instance *hwe)
+{
+ struct pceu_cycles pceu1[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
+ struct pceu_cycles pceu2[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
+ struct spin_ctx *ctx = NULL;
+ uint32_t vm;
+
+ vm = xe_vm_create(fd, 0, 0);
+ ctx = spin_ctx_init(fd, hwe, vm, 1, 1);
+ spin_sync_start(fd, ctx);
+
+ read_engine_cycles(fd, pceu1);
+ usleep(batch_duration_ns / 1000);
+
+ /* destroy queue before sampling again */
+ spin_sync_end(fd, ctx);
+ spin_ctx_destroy(fd, ctx);
+
+ read_engine_cycles(fd, pceu2);
+
+ xe_vm_destroy(fd, vm);
+
+ check_results(pceu1, pceu2, hwe->engine_class, 1, TEST_BUSY);
+}
+
static void
single(int fd, struct drm_xe_engine_class_instance *hwe, int width, int count,
unsigned int flags)
@@ -837,6 +866,10 @@ igt_main
xe_for_each_multi_engine(xe, hwe, count)
single(xe, hwe, count, 1, TEST_BUSY | TEST_TRAILING_IDLE | TEST_ISOLATION);
+ igt_subtest("drm-busy-exec-queue-destroy-idle")
+ xe_for_each_engine(xe, hwe)
+ single_destroy_queue(xe, hwe);
+
igt_describe("Create and compare total and resident memory consumption by client");
igt_subtest("drm-total-resident")
test_total_resident(xe);
--
2.38.1
More information about the igt-dev
mailing list