[PATCH i-g-t] tests/intel/xe_pxp: Terminate PXP on exit
Daniele Ceraolo Spurio
daniele.ceraolospurio at intel.com
Thu Apr 17 23:57:19 UTC 2025
Most of out tests expect to start their execution from a clean GPU state.
However, the PXP tests currently leave a PXP session running when they
complete, so follow up tests will not have a clean starting state; given
that PXP can impact the timing of some operations (e.g. suspend/resume),
this could pollute the results of those tests. Therefore, let's make
sure that PXP is de-activated before we exit.
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
Cc: Alan Previn <alan.previn.teres.alexis at intel.com>
---
tests/intel/xe_pxp.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/tests/intel/xe_pxp.c b/tests/intel/xe_pxp.c
index 458d32322..3442396b2 100644
--- a/tests/intel/xe_pxp.c
+++ b/tests/intel/xe_pxp.c
@@ -1140,9 +1140,23 @@ static void termination_tests(int fd, bool pxp_supported, drmModeResPtr res,
}
}
+int xe_fd = -1;
+
+static void exit_handler(int sig)
+{
+ /*
+ * PXP can interact with some operations (e.g. suspend/resume), which
+ * could impact the behavior of other tests if they unknowingly start
+ * when PXP is already active. Therefore, let's make sure PXP is
+ * de-activated before we exit.
+ */
+ trigger_termination(xe_fd, PXP_TERMINATION_IRQ);
+ drm_close_driver(xe_fd);
+ usleep(50 * 1000); /* give time for the termination to be processed */
+}
+
igt_main
{
- int xe_fd = -1;
bool pxp_supported = true;
drmModeResPtr res;
@@ -1151,6 +1165,7 @@ igt_main
igt_require(xe_has_engine_class(xe_fd, DRM_XE_ENGINE_CLASS_RENDER));
pxp_supported = is_pxp_hw_supported(xe_fd);
res = drmModeGetResources(xe_fd);
+ igt_install_exit_handler(exit_handler);
}
igt_subtest_group {
@@ -1213,8 +1228,6 @@ igt_main
}
}
- igt_fixture {
+ igt_fixture
drmModeFreeResources(res);
- close(xe_fd);
- }
}
--
2.43.0
More information about the igt-dev
mailing list