Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pranay Samala <pranay.samala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, kunal1.joshi@intel.com,
	sameer.lattannavar@intel.com, pranay.samala@intel.com
Subject: [PATCH i-g-t v3 5/5] lib/igt_sysfs: Move igt_exit_handler into test
Date: Tue,  1 Apr 2025 14:50:15 +0530	[thread overview]
Message-ID: <20250401092015.818465-6-pranay.samala@intel.com> (raw)
In-Reply-To: <20250401092015.818465-1-pranay.samala@intel.com>

In case of nested updated the exit handler will be called multiple
times. Hence calling it before the updates rather than calling after
update.

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@intel.com>
---
 lib/igt_sysfs.c                         | 9 +--------
 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(+), 8 deletions(-)

diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 0df2ab9fc..735b8c29f 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();
 }
@@ -532,13 +532,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_level_reset_exit_handler);
-
 }
 
 /**
diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h
index 2f4d25bf6..c351e3069 100644
--- a/lib/igt_sysfs.h
+++ b/lib/igt_sysfs.h
@@ -143,6 +143,7 @@ void igt_sysfs_set_boolean(int dir, const char *attr, bool value);
 void bind_fbcon(bool enable);
 void fbcon_blink_enable(bool enable);
 
+void igt_drm_debug_mask_reset_exit_handler(int sig);
 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);
diff --git a/tests/intel/kms_dp_linktrain_fallback.c b/tests/intel/kms_dp_linktrain_fallback.c
index a6f7b586f..a093f651a 100644
--- a/tests/intel/kms_dp_linktrain_fallback.c
+++ b/tests/intel/kms_dp_linktrain_fallback.c
@@ -643,6 +643,7 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
 		for_each_pipe(&data.display, data.pipe)
 			data.n_pipes++;
 
+		igt_install_exit_handler(igt_drm_debug_mask_reset_exit_handler);
 		if (parse_bitmask)
 			igt_drm_debug_mask_update(parse_bitmask);
 		else
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index a92edc2b1..7403e829e 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -1194,6 +1194,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);
 		if (parse_bitmask)
 			igt_drm_debug_mask_update(parse_bitmask);
 		else
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 09d511935..2985e4852 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1872,6 +1872,7 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
 		 */
 		intel_psr2_restore = i915_psr2_sel_fetch_to_psr1(display.drm_fd, NULL);
 
+		igt_install_exit_handler(igt_drm_debug_mask_reset_exit_handler);
 		if (parse_bitmask)
 			igt_drm_debug_mask_update(parse_bitmask);
 		else
-- 
2.34.1


  parent reply	other threads:[~2025-04-01  9:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01  9:20 [PATCH i-g-t v3 0/5] Refactor DRM Debug Severity Handling for Pranay Samala
2025-04-01  9:20 ` [PATCH i-g-t v3 1/5] lib/igt_sysfs: Usage of Original debug mask to read/reset Pranay Samala
2025-04-23 11:49   ` [i-g-t,v3,1/5] " Joshi, Kunal1
2025-04-01  9:20 ` [PATCH i-g-t v3 2/5] lib/igt_sysfs: Rename debug level APIs/variables to debug mask Pranay Samala
2025-04-23 11:56   ` [i-g-t,v3,2/5] " Joshi, Kunal1
2025-04-01  9:20 ` [PATCH i-g-t v3 3/5] lib/igt_sysfs: Update new debug mask requested by user Pranay Samala
2025-04-01  9:20 ` [PATCH i-g-t v3 4/5] tests/kms: Add parse_bitmask support for user Pranay Samala
2025-04-03 15:18   ` Jani Nikula
2025-04-23 12:23   ` [i-g-t,v3,4/5] " Joshi, Kunal1
2025-04-01  9:20 ` Pranay Samala [this message]
2025-04-01 10:04 ` [PATCH i-g-t v3 0/5] Refactor DRM Debug Severity Handling for Samala, Pranay
2025-04-01 12:24 ` ✗ i915.CI.BAT: failure for " Patchwork
2025-04-01 12:30 ` ✓ Xe.CI.BAT: success " Patchwork
2025-04-01 14:39 ` ✗ Xe.CI.Full: failure " Patchwork
2025-04-06 22:24 ` Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250401092015.818465-6-pranay.samala@intel.com \
    --to=pranay.samala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.b.s@intel.com \
    --cc=kunal1.joshi@intel.com \
    --cc=sameer.lattannavar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox