[PATCH i-g-t 2/2] tests/intel/xe_drm_fdinfo: Ensure queue destroy records load correctly
Lucas De Marchi
lucas.demarchi at intel.com
Fri Aug 23 23:02:50 UTC 2024
From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
If the exec queue is destroyed before recording the utilization, make
sure the load is correctly captured: the drm client is still alive, so
it should still have the load recorded.
v2:
- s/measured_usleep/usleep
- remove xe_ prefix from helpers/structures
v3:
- Rebase and remove traces of parallel/virtual (Lucas)
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi 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 230deae8d..4696c6495 100644
--- a/tests/intel/xe_drm_fdinfo.c
+++ b/tests/intel/xe_drm_fdinfo.c
@@ -46,6 +46,9 @@
* SUBTEST: drm-all-busy-idle-check-all
* Description: Check that all engines show busy when all are loaded
*
+ * 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
*
@@ -558,6 +561,32 @@ busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe, unsigned int fl
xe_vm_destroy(fd, vm);
}
+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);
+ 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, TEST_BUSY);
+}
+
static void
most_busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe,
unsigned int flags)
@@ -689,6 +718,10 @@ igt_main
igt_subtest("drm-all-busy-idle-check-all")
all_busy_check_all(xe, TEST_BUSY | TEST_TRAILING_IDLE);
+ 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.43.0
More information about the igt-dev
mailing list