[PATCH i-g-t v4 5/5] lib/igt_sysfs: Move igt_exit_handler into test
Naladala, Ramanaidu
Ramanaidu.naladala at intel.com
Thu Jul 3 21:41:26 UTC 2025
On 6/4/2025 11:00 AM, Pranay Samala wrote:
> In case of nested updated the exit handler will be called multiple
> times. Hence calling it before the updates rather than calling after
> update.
>
> v3:
> - Refactored for readability and address logical comment.
>
> Fixes: 56b91193b825 ("lib/igt_sysfs: Implement dynamic adjustment of debug log level")
> Fixes: a2ab0ec12ef4 ("tests/kms_atomic_transition: Reducing debug loglevel dynamically")
> Fixes: 4baeb7397d71 ("tests/intel/kms_dp_linktrain_fallback: Reduce debug loglevel dynamically")
> Fixes: 7a8a3744466f ("tests/kms_cursor_legacy: Reduce debug loglevel dynamically")
> Signed-off-by: Pranay Samala<pranay.samala at intel.com>
> ---
> lib/igt_sysfs.c | 8 +-------
> lib/igt_sysfs.h | 1 +
> tests/intel/kms_dp_linktrain_fallback.c | 1 +
> tests/kms_atomic_transition.c | 1 +
> tests/kms_cursor_legacy.c | 1 +
> 5 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
> index 427aed4de..c90881d53 100644
> --- a/lib/igt_sysfs.c
> +++ b/lib/igt_sysfs.c
> @@ -493,7 +493,7 @@ void igt_drm_debug_mask_reset(void)
> close(dir);
> }
>
> -static void igt_drm_debug_mask_reset_exit_handler(int sig)
> +void igt_drm_debug_mask_reset_exit_handler(int sig)
> {
> igt_drm_debug_mask_reset();
> }
> @@ -531,12 +531,6 @@ void igt_drm_debug_mask_update(unsigned int mask_to_set)
> igt_assert(igt_sysfs_set(dir, "debug", buf));
>
> close(dir);
> -
> - /*
> - * TODO: Check whether multiple exit handlers will get installed,
> - * if we call this api multiple times
> - */
> - igt_install_exit_handler(igt_drm_debug_mask_reset_exit_handler);
> }
>
> /**
> diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h
> index 06badaf0e..583be5d98 100644
> --- a/lib/igt_sysfs.h
> +++ b/lib/igt_sysfs.h
> @@ -147,6 +147,7 @@ void igt_drm_debug_mask_update(unsigned int new_log_level);
> void igt_drm_debug_mask_reset(void);
> int igt_drm_debug_mask_get(int dir);
> int igt_sysfs_drm_module_params_open(void);
> +void igt_drm_debug_mask_reset_exit_handler(int sig);
>
> enum drm_debug_category {
> DRM_UT_CORE = 1 << 0,
> diff --git a/tests/intel/kms_dp_linktrain_fallback.c b/tests/intel/kms_dp_linktrain_fallback.c
> index 9cd6f3d54..adbaa0749 100644
> --- a/tests/intel/kms_dp_linktrain_fallback.c
> +++ b/tests/intel/kms_dp_linktrain_fallback.c
> @@ -616,6 +616,7 @@ igt_main
> for_each_pipe(&data.display, data.pipe)
> data.n_pipes++;
>
> + igt_install_exit_handler(igt_drm_debug_mask_reset_exit_handler);
> update_debug_mask_if_ci(debug_mask_if_ci);
>
> /*
> diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> index 3202ab668..486d5b2ab 100644
> --- a/tests/kms_atomic_transition.c
> +++ b/tests/kms_atomic_transition.c
> @@ -1197,6 +1197,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
> for_each_connected_output(&data.display, output)
> count++;
>
> + igt_install_exit_handler(igt_drm_debug_mask_reset_exit_handler);
> update_debug_mask_if_ci(debug_mask_if_ci);
> }
>
> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
> index 281812a4d..74118c014 100644
> --- a/tests/kms_cursor_legacy.c
> +++ b/tests/kms_cursor_legacy.c
> @@ -1861,6 +1861,7 @@ igt_main
> */
> intel_psr2_restore = i915_psr2_sel_fetch_to_psr1(display.drm_fd, NULL);
>
> + igt_install_exit_handler(igt_drm_debug_mask_reset_exit_handler);
> update_debug_mask_if_ci(debug_mask_if_ci);
> }
LGTM,
Reviewed-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20250704/b6e3e89f/attachment-0001.htm>
More information about the igt-dev
mailing list