Skip to contentSkip to conversation

PM Suspend debug

PATCH Superseded Anshuman Gupta 3 participants 5 messages Jun 26, 2023 Library code

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover PM Suspend debug

This series enhance PM Suspend/Resume debug.

1. Disables console_suspend.
v1: https://patchwork.freedesktop.org/series/114517/
2. Enables /sys/power/pm_debug_messages.

Anshuman Gupta (2):
lib/igt_aux: Disable console suspend for suspend test lib/igt_aux: Enable PM Suspend dbg messages

 lib/igt_aux.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/2 lib/igt_aux: Disable console suspend for suspend test

We need no_console_suspend to be enable in order to dump the suspend logs over serial console before attempting the suspend during CI Execution.
Therefore disable the console_suspend using printk module parameters while executing suspend test.

v2:
- Keep console_suspend restore only in exit handler. [Ashutosh]
- Don't skip the test on open error, while opening printk parameters, instead print warning. [Kmail]
v3:
- Fixed cosmetics and return value comment. [Ashutosh]
v4:
- Added igt_aux_enable_pm_suspend_dbg() function doc. [Kmail]

---
 lib/igt_aux.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
lib/igt_aux.c +45 -0
index 386e257834..5eb6d9e270 100644
@@ -702,6 +702,10 @@ void igt_print_activity(void)
 }
 
 static int autoresume_delay;
+bool __console_suspend_saved_state;
+
+#define SYSFS_MODULE_PRINTK "/sys/module/printk/parameters/"
+#define CONSOLE_SUSPEND_DISABLE false
 
 static const char *suspend_state_name[] = {
 	[SUSPEND_STATE_FREEZE] = "freeze",
@@ -907,6 +911,46 @@ static bool is_mem_sleep_state_supported(int power_dir, enum igt_mem_sleep state
 	return str;
 }
 
+static void igt_aux_pm_suspend_dbg_restore_exit_handler(int sig)
+{
+	int sysfs_fd;
+
+	sysfs_fd = open(SYSFS_MODULE_PRINTK, O_RDONLY);
+
+	if (sysfs_fd < 0)
+		return;
+
+	igt_sysfs_set_boolean(sysfs_fd, "console_suspend", __console_suspend_saved_state);
+	close(sysfs_fd);
+}
+
+/**
+ * igt_aux_enable_pm_suspend_dbg:
+ *
+ * Enhance the System wide suspend/resume debugging by,
+ * disabling console suspend. Disabling console suspend dump the suspend/resume
+ * logs over serial console. That will be useful to debug CI Suspend/Resume issues
+ * tagged with 'Incomplete' result.
+ */
+static void igt_aux_enable_pm_suspend_dbg(void)
+{
+	int sysfs_fd;
+
+	sysfs_fd = open(SYSFS_MODULE_PRINTK, O_RDONLY);
+	if (sysfs_fd > 0) {
+		__console_suspend_saved_state = igt_sysfs_get_boolean(sysfs_fd, "console_suspend");
+
+		if (!igt_sysfs_set_boolean(sysfs_fd, "console_suspend", CONSOLE_SUSPEND_DISABLE))
+			igt_warn("Unable to disable console suspend\n");
+
+		igt_install_exit_handler(igt_aux_pm_suspend_dbg_restore_exit_handler);
+	} else {
+		igt_warn("Unable to open printk parameters Err:%d\n", errno);
+	}
+
+	close(sysfs_fd);
+}
+
 /**
  * igt_system_suspend_autoresume:
  * @state: an #igt_suspend_state, the target suspend state
@@ -945,6 +989,7 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
 		      "Suspend to disk requires swap space.\n");
 
 	orig_test = get_suspend_test(power_dir);
+	igt_aux_enable_pm_suspend_dbg();
 
 	if (state == SUSPEND_STATE_S3) {
 		orig_mem_sleep = get_mem_sleep();
Signature · 1 line
2.25.1
#2 lore raw

PATCH v4 2/2 lib/igt_aux: Enable PM Suspend dbg messages

In reply to Anshuman Gupta

Enabling PM Suspend dbg messages by turning on /sys/power/pm_debug_messages switch also adding an exit handler provision to restore the pm_debug_messages state.

v2:
- Fixed sysfs_fd leak. [Badal]
v3:
- Added igt_aux_enable_pm_suspend_dbg() function doc. [Kmail]

---
 lib/igt_aux.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)
lib/igt_aux.c +28 -7
index 5eb6d9e270..35263b4519 100644
@@ -703,6 +703,7 @@ void igt_print_activity(void)
 
 static int autoresume_delay;
 bool __console_suspend_saved_state;
+bool __pm_debug_messages_state;
 
 #define SYSFS_MODULE_PRINTK "/sys/module/printk/parameters/"
 #define CONSOLE_SUSPEND_DISABLE false
@@ -913,7 +914,7 @@ static bool is_mem_sleep_state_supported(int power_dir, enum igt_mem_sleep state
 
 static void igt_aux_pm_suspend_dbg_restore_exit_handler(int sig)
 {
-	int sysfs_fd;
+	int sysfs_fd, power_dir;
 
 	sysfs_fd = open(SYSFS_MODULE_PRINTK, O_RDONLY);
 
@@ -922,17 +923,30 @@ static void igt_aux_pm_suspend_dbg_restore_exit_handler(int sig)
 
 	igt_sysfs_set_boolean(sysfs_fd, "console_suspend", __console_suspend_saved_state);
 	close(sysfs_fd);
+	power_dir = open("/sys/power", O_RDONLY);
+
+	if (power_dir <  0)
+		return;
+
+	if (!faccessat(power_dir, "pm_debug_messages", R_OK |  W_OK, 0))
+		igt_sysfs_set_boolean(power_dir, "pm_debug_messages", __pm_debug_messages_state);
+
+	close(power_dir);
 }
 
 /**
  * igt_aux_enable_pm_suspend_dbg:
+ * @power_dir: /sys/power/ dir fd
  *
  * Enhance the System wide suspend/resume debugging by,
- * disabling console suspend. Disabling console suspend dump the suspend/resume
- * logs over serial console. That will be useful to debug CI Suspend/Resume issues
- * tagged with 'Incomplete' result.
+ * disabling console suspend and enabling PM debug messages.
+ * Disabling console suspend dump the suspend/resume logs over serial console.
+ * That will be useful to debug CI Suspend/Resume issues tagged
+ * with 'Incomplete' result.
+ * pm_debug_messages sysfs enables Linux PM Core debug messages, which will
+ * be useful to debug system wide suspend/resume related issues.
  */
-static void igt_aux_enable_pm_suspend_dbg(void)
+static void igt_aux_enable_pm_suspend_dbg(int power_dir)
 {
 	int sysfs_fd;
 
@@ -943,11 +957,18 @@ static void igt_aux_enable_pm_suspend_dbg(void)
 		if (!igt_sysfs_set_boolean(sysfs_fd, "console_suspend", CONSOLE_SUSPEND_DISABLE))
 			igt_warn("Unable to disable console suspend\n");
 
-		igt_install_exit_handler(igt_aux_pm_suspend_dbg_restore_exit_handler);
 	} else {
 		igt_warn("Unable to open printk parameters Err:%d\n", errno);
 	}
 
+	/* pm_debug_messages depends on  CONFIG_PM_SLEEP_DEBUG */
+	if (!faccessat(power_dir, "pm_debug_messages", R_OK |  W_OK, 0)) {
+		__pm_debug_messages_state = igt_sysfs_get_boolean(sysfs_fd, "pm_debug_messages");
+		igt_sysfs_set_boolean(power_dir, "pm_debug_messages", true);
+	}
+
+	igt_install_exit_handler(igt_aux_pm_suspend_dbg_restore_exit_handler);
+
 	close(sysfs_fd);
 }
 
@@ -989,7 +1010,7 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
 		      "Suspend to disk requires swap space.\n");
 
 	orig_test = get_suspend_test(power_dir);
-	igt_aux_enable_pm_suspend_dbg();
+	igt_aux_enable_pm_suspend_dbg(power_dir);
 
 	if (state == SUSPEND_STATE_S3) {
 		orig_mem_sleep = get_mem_sleep();
Signature · 1 line
2.25.1
Reviewed-by on v4 2/2
#3 lore raw

Re: [igt-dev] [PATCH i-g-t v4 2/2] lib/igt_aux: Enable PM Suspend dbg messages

Quoted 1 line · Anshuman Gupta

Hi Anshuman,

Quoted 38 lines

Enabling PM Suspend dbg messages by turning on /sys/power/pm_debug_messages switch also adding an exit handler provision to restore the pm_debug_messages state.

v2:
- Fixed sysfs_fd leak. [Badal]
v3:
- Added igt_aux_enable_pm_suspend_dbg() function doc. [Kmail]

---
 lib/igt_aux.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)
lib/igt_aux.c +2 -1
index 5eb6d9e270..35263b4519 100644
@@ -703,6 +703,7 @@ void igt_print_activity(void)
 
 static int autoresume_delay;
 bool __console_suspend_saved_state;
+bool __pm_debug_messages_state;
 
 #define SYSFS_MODULE_PRINTK "/sys/module/printk/parameters/"
 #define CONSOLE_SUSPEND_DISABLE false
@@ -913,7 +914,7 @@ static bool is_mem_sleep_state_supported(int power_dir, enum igt_mem_sleep state
 
 static void igt_aux_pm_suspend_dbg_restore_exit_handler(int sig)
 {
-	int sysfs_fd;
+	int sysfs_fd, power_dir;
 
 	sysfs_fd = open(SYSFS_MODULE_PRINTK, O_RDONLY);
 

lib/igt_aux.c static void igt_aux_pm_suspend_dbg_restore_exit_handler(int sig) · line 925

Quoted 3 lines
lib/igt_aux.c +0 -0
@@ -922,17 +923,30 @@ static void igt_aux_pm_suspend_dbg_restore_exit_handler(int sig)
 
 	igt_sysfs_set_boolean(sysfs_fd, "console_suspend", __console_suspend_saved_state);
 	close(sysfs_fd);

Maybe add an empty line here.

lib/igt_aux.c static void igt_aux_pm_suspend_dbg_restore_exit_handler(int sig) · line 927

Quoted 2 lines
lib/igt_aux.c +2 -0
+	power_dir = open("/sys/power", O_RDONLY);
+

And delete this empty line.

Quoted 4 lines
lib/igt_aux.c +4 -0
+	if (power_dir <  0)
+		return;
+
+	if (!faccessat(power_dir, "pm_debug_messages", R_OK |  W_OK, 0))

lib/igt_aux.c static void igt_aux_pm_suspend_dbg_restore_exit_handler(int sig) · line 941

Quoted 10 lines
lib/igt_aux.c +4 -0
+		igt_sysfs_set_boolean(power_dir, "pm_debug_messages", __pm_debug_messages_state);
+
+	close(power_dir);
 }
 
 /**
  * igt_aux_enable_pm_suspend_dbg:
+ * @power_dir: /sys/power/ dir fd
  *
  * Enhance the System wide suspend/resume debugging by,

No comma needed (it's from previous patch).

Apart from above nits, lgtm:

#4 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for PM Suspend debug (rev5)

In reply to Anshuman Gupta
== Series Details ==

== Series Details ==

Series: PM Suspend debug (rev5)
URL : https://patchwork.freedesktop.org/series/119371/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13322 -> IGTPW_9255
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_9255 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_9255, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/index.html

Participating hosts (42 -> 41)
------------------------------

Missing (1): fi-snb-2520m

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_9255:

### IGT changes ###

#### Possible regressions ####

* igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-vga-1:
- fi-hsw-4770: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/fi-hsw-4770/igt@kms_pipe_crc_basic@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/fi-hsw-4770/igt@kms_pipe_crc_basic@[email protected]

Known issues
------------

Here are the changes found in IGTPW_9255 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_parallel@engines@userptr:
- bat-mtlp-6: [PASS][3] -> [FAIL][4] ([i915#8672])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/bat-mtlp-6/igt@gem_exec_parallel@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-mtlp-6/igt@gem_exec_parallel@[email protected]

* igt@i915_module_load@load:
- bat-adlp-11: [PASS][5] -> [ABORT][6] ([i915#4423])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/bat-adlp-11/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-adlp-11/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- fi-glk-j4005: [PASS][7] -> [DMESG-FAIL][8] ([i915#5334])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/fi-glk-j4005/igt@i915_selftest@live@gt_heartbeat.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/fi-glk-j4005/igt@i915_selftest@live@gt_heartbeat.html

* igt@i915_selftest@live@gt_mocs:
- bat-mtlp-6: [PASS][9] -> [DMESG-FAIL][10] ([i915#7059])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html

* igt@i915_selftest@live@requests:
- bat-rpls-2: [PASS][11] -> [ABORT][12] ([i915#4983] / [i915#7913])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/bat-rpls-2/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-rpls-2/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@slpc:
- bat-mtlp-6: [PASS][13] -> [DMESG-WARN][14] ([i915#6367])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/bat-mtlp-6/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-mtlp-6/igt@i915_selftest@[email protected]
- bat-rpls-1: NOTRUN -> [DMESG-WARN][15] ([i915#6367])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-rpls-1/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- bat-rpls-1: NOTRUN -> [ABORT][16] ([i915#6687] / [i915#7978])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-rpls-1/igt@[email protected]

* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-dg2-11: NOTRUN -> [SKIP][17] ([i915#7828])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-dg2-11/igt@[email protected]

#### Possible fixes ####

* igt@gem_basic@create-close:
- fi-kbl-soraka: [INCOMPLETE][18] -> [PASS][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/fi-kbl-soraka/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/fi-kbl-soraka/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: [DMESG-FAIL][20] ([i915#5334] / [i915#7872]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html

* igt@i915_selftest@live@gt_mocs:
- bat-mtlp-8: [DMESG-FAIL][22] ([i915#7059]) -> [PASS][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-mtlp-8/igt@i915_selftest@live@gt_mocs.html

* igt@i915_selftest@live@hangcheck:
- bat-dg2-11: [INCOMPLETE][24] ([i915#7913]) -> [PASS][25]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/bat-dg2-11/igt@i915_selftest@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-dg2-11/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@requests:
- bat-rpls-1: [ABORT][26] ([i915#7911] / [i915#7920] / [i915#7982]) -> [PASS][27]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/bat-rpls-1/igt@i915_selftest@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-rpls-1/igt@i915_selftest@[email protected]

#### Warnings ####

* igt@kms_psr@primary_page_flip:
- bat-rplp-1: [SKIP][28] ([i915#1072]) -> [ABORT][29] ([i915#8442])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13322/bat-rplp-1/igt@kms_psr@primary_page_flip.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/bat-rplp-1/igt@kms_psr@primary_page_flip.html

[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#4423]: https://gitlab.freedesktop.org/drm/intel/issues/4423
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
[i915#7059]: https://gitlab.freedesktop.org/drm/intel/issues/7059
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7872]: https://gitlab.freedesktop.org/drm/intel/issues/7872
[i915#7911]: https://gitlab.freedesktop.org/drm/intel/issues/7911
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7920]: https://gitlab.freedesktop.org/drm/intel/issues/7920
[i915#7978]: https://gitlab.freedesktop.org/drm/intel/issues/7978
[i915#7982]: https://gitlab.freedesktop.org/drm/intel/issues/7982
[i915#8442]: https://gitlab.freedesktop.org/drm/intel/issues/8442
[i915#8672]: https://gitlab.freedesktop.org/drm/intel/issues/8672

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_7349 -> IGTPW_9255

CI-20190529: 20190529
CI_DRM_13322: 7067d1a82560a2e79adefac0d28e08cb163ae907 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_9255: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/index.html
IGT_7349: eba3d515fbb832edc7fabcbf90e2564aa7face7b @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9255/index.html