[PATCH i-g-t v2] tests/intel/xe_pxp: Terminate PXP on exit
Kamil Konieczny
kamil.konieczny at linux.intel.com
Wed Apr 30 11:29:44 UTC 2025
Hi Daniele,
On 2025-04-29 at 16:49:24 -0700, Daniele Ceraolo Spurio wrote:
> 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.
>
> While at it, update the fd cleanup to use drm_close_driver() instead
> of close().
>
> v2: only do the termination if PXP is supported.
>
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> Cc: Alan Previn <alan.previn.teres.alexis at intel.com>
> Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com> #v1
My r-b holds, I will merge it soon, thank you for contribution.
Regards,
Kamil
> ---
> tests/intel/xe_pxp.c | 21 +++++++++++++++++++--
> 1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/tests/intel/xe_pxp.c b/tests/intel/xe_pxp.c
> index 458d32322..9eddc03fc 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,8 @@ 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);
> + if (pxp_supported)
> + igt_install_exit_handler(exit_handler);
> }
>
> igt_subtest_group {
> @@ -1215,6 +1231,7 @@ igt_main
>
> igt_fixture {
> drmModeFreeResources(res);
> - close(xe_fd);
> + if (!pxp_supported)
> + drm_close_driver(xe_fd);
> }
> }
> --
> 2.43.0
>
More information about the igt-dev
mailing list