[PATCH i-g-t] tests/intel/xe_pxp: Terminate PXP on exit
Daniele Ceraolo Spurio
daniele.ceraolospurio at intel.com
Fri Apr 18 16:53:42 UTC 2025
On 4/18/2025 7:54 AM, Kamil Konieczny wrote:
> Hi Daniele,
> On 2025-04-17 at 16:57:19 -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),
> What kind of problems could occur? Is it longer wakeup or refusing
> to enter sleep?
PXP can delay the suspend flow or, in some unlikely error cases, cause
the driver to abort the suspend attempt. AFAIU it can also delay
idleness for the media GT.
>
>> 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);
> Looks like you are fixing a bug here, it should be
> drm_close_driver(xe_fd);
>
> LGTM,
> Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Thanks!
Daniele
>
>
>> - }
>> }
>> --
>> 2.43.0
>>
More information about the igt-dev
mailing list