Skip to contentSkip to conversation

igt_aux: Skip hibernation attempts if hibernation is not configured

PATCH In review Petri Latvala 3 participants 7 messages Dec 21, 2017 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igt_aux: Skip hibernation attempts if hibernation is not configured

rtcwake doesn't give us meaningful ways of differentiating different reasons for hibernation failing. CI doesn't configure hibernation to work at this time, and hibernation attempts will always fail. Check for the configuration in the form of resume= appearing on the kernel command line, which is what swsusp uses to find the resume device to hibernate to.

Hibernation failures have dug up a couple of bugs in the past, but finding actual bugs in the swamp of "rtcwake failed with 1" results is difficult enough to overweigh that benefit.

Note that this only makes full hibernation to skip on unconfigured systems. Limiting the suspend level in igt_system_suspend_autoresume to anything other than full level still suspends.

References: https://bugs.freedesktop.org/show_bug.cgi?id=103375

Cc Marta Lofstedt <[email protected]>
Cc Tomi Sarvela <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
---
 lib/igt_aux.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
lib/igt_aux.c +32 -0
index 8ca0b60d..86d9c5b9 100644
@@ -775,6 +775,29 @@ static void set_suspend_test(int power_dir, enum igt_suspend_test test)
 	igt_assert(igt_sysfs_set(power_dir, "pm_test", suspend_test_name[test]));
 }
 
+static bool hibernate_configured(void)
+{
+	FILE *file;
+	size_t n = 0;
+	char *line = NULL;
+	bool matched = false;
+
+	file = fopen("/proc/cmdline", "r");
+	if (!file) {
+		/* Cannot check. Assume the best. */
+		return true;
+	}
+
+	if (getline(&line, &n, file) >= 0) {
+		matched = strstr(line, "resume=") != NULL;
+	}
+
+	free(line);
+	fclose(file);
+
+	return matched;
+}
+
 #define SQUELCH ">/dev/null 2>&1"
 
 static void suspend_via_rtcwake(enum igt_suspend_state state)
@@ -798,6 +821,15 @@ static void suspend_via_rtcwake(enum igt_suspend_state state)
 		     "the rtcwake tool or how your distro is set up.\n",
 		      ret);
 
+	/*
+	 * Skip if attempting to suspend to disk and hibernation is
+	 * not configured.
+	 */
+	if (state == SUSPEND_STATE_DISK) {
+		igt_require_f(hibernate_configured(),
+			      "Cannot suspend to disk; Hibernation device not configured.\n");
+	}
+
 	snprintf(cmd, sizeof(cmd), "rtcwake -s %d -m %s ",
 		 delay, suspend_state_name[state]);
 	ret = igt_system(cmd);
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting Petri Latvala (2017-12-21 12:53:41)

Quoted 6 lines

rtcwake doesn't give us meaningful ways of differentiating different reasons for hibernation failing. CI doesn't configure hibernation to work at this time, and hibernation attempts will always fail. Check for the configuration in the form of resume= appearing on the kernel command line, which is what swsusp uses to find the resume device to hibernate to.

resume= is not required for hibernation.

Quoted 3 lines

Hibernation failures have dug up a couple of bugs in the past, but finding actual bugs in the swamp of "rtcwake failed with 1" results is difficult enough to overweigh that benefit.

The ones in CI are genuine though, does it not appear? At the start of the hibernate it picks swapspace to store the image, but at the end of the sequence, it can not read back from the swapspace it chose. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 9 lines · Chris Wilson

Quoting Petri Latvala (2017-12-21 12:53:41)

Quoted 6 lines

rtcwake doesn't give us meaningful ways of differentiating different reasons for hibernation failing. CI doesn't configure hibernation to work at this time, and hibernation attempts will always fail. Check for the configuration in the form of resume= appearing on the kernel command line, which is what swsusp uses to find the resume device to hibernate to.

resume= is not required for hibernation.

Oh bugger, I was blind. swsusp_resume_device update is right there in swsusp_swap_check().

swsusp_resume_block is not updated there though. That's needed to hibernate to swapfile.

Quoted 8 lines
Quoted 4 lines

Hibernation failures have dug up a couple of bugs in the past, but finding actual bugs in the swamp of "rtcwake failed with 1" results is difficult enough to overweigh that benefit.

The ones in CI are genuine though, does it not appear? At the start of the hibernate it picks swapspace to store the image, but at the end of the sequence, it can not read back from the swapspace it chose.

... and the above is what happens in CI. Correct device is checked but offset is missing.

Suggestions how to proceed? Does resuming from a swapfile work automatically without resume_offset= on cmdline? Then it would be a matter of updating swsusp_resume_block in swsusp_swap_check. If not, check that either 1) a partition exists in /proc/swaps 2) resume_offset is on cmdline?

Signature · 5 lines
Petri Latvala
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Quoting Petri Latvala (2017-12-21 13:18:16)

Quoted 26 lines · Chris Wilson
Quoted 9 lines

Quoting Petri Latvala (2017-12-21 12:53:41)

Quoted 6 lines

rtcwake doesn't give us meaningful ways of differentiating different reasons for hibernation failing. CI doesn't configure hibernation to work at this time, and hibernation attempts will always fail. Check for the configuration in the form of resume= appearing on the kernel command line, which is what swsusp uses to find the resume device to hibernate to.

resume= is not required for hibernation.

Oh bugger, I was blind. swsusp_resume_device update is right there in swsusp_swap_check().

swsusp_resume_block is not updated there though. That's needed to hibernate to swapfile.

Quoted 8 lines
Quoted 4 lines

Hibernation failures have dug up a couple of bugs in the past, but finding actual bugs in the swamp of "rtcwake failed with 1" results is difficult enough to overweigh that benefit.

The ones in CI are genuine though, does it not appear? At the start of the hibernate it picks swapspace to store the image, but at the end of the sequence, it can not read back from the swapspace it chose.

Quoted 8 lines

... and the above is what happens in CI. Correct device is checked but offset is missing.

Suggestions how to proceed? Does resuming from a swapfile work automatically without resume_offset= on cmdline? Then it would be a matter of updating swsusp_resume_block in swsusp_swap_check. If not, check that either 1) a partition exists in /proc/swaps 2) resume_offset is on cmdline?

I've never used resume=/resume_offset= and hibernate (both from the desktop and echo disk > /sys/power/state) works. Why CI doesn't work is a mystery. Is it worth seeing if it has ever worked (without extra modules like i915.ko loaded) on one of those machines and do a regression hunt? -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 3 lines · Chris Wilson

I've never used resume=/resume_offset= and hibernate (both from the desktop and echo disk > /sys/power/state) works. Why CI doesn't work is a mystery.

Do you have your swap on a partition? CI has it on a file.

Signature · 5 lines
Petri Latvala
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

✓ Fi.CI.BAT: success for series starting with [1/1] igt_aux: Skip hibernation attempts if hibernation is not configured

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: series starting with [1/1] igt_aux: Skip hibernation attempts if hibernation is not configured
URL : https://patchwork.freedesktop.org/series/35680/
State : success

== Summary ==

IGT patchset tested on top of latest successful build beb26d89ff5c5621c1e6b6ac2a45439507af86b7 meson: Install .testlist files and README from tests/intel-ci

with latest DRM-Tip kernel build CI_DRM_3564
4b29b69aee8c drm-tip: 2017y-12m-21d-11h-10m-15s UTC integration manifest

No testlist changes.

Test gem_mmap_gtt:

        Subgroup basic-small-bo-tiledx:
                pass       -> FAIL       (fi-gdg-551) fdo#102575
Test kms_psr_sink_crc:
        Subgroup psr_basic:
                pass       -> DMESG-WARN (fi-skl-6700hq) fdo#101144

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#101144 https://bugs.freedesktop.org/show_bug.cgi?id=101144

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:437s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:442s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:388s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:499s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:277s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:502s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:498s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:479s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:471s
fi-elk-e7500     total:224  pass:163  dwarn:15  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:264s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:533s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:404s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:412s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:431s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:482s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:428s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:479s
fi-kbl-7560u     total:288  pass:268  dwarn:1   dfail:0   fail:0   skip:19  time:524s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:462s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:530s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:602s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:444s
fi-skl-6600u     total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:536s
fi-skl-6700hq    total:288  pass:261  dwarn:1   dfail:0   fail:0   skip:26  time:555s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:511s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:498s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:443s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:553s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:409s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:593s
fi-cnl-y         total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:630s
fi-glk-dsi       total:288  pass:175  dwarn:1   dfail:4   fail:0   skip:108 time:325s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_721/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

✓ Fi.CI.IGT: success for series starting with [1/1] igt_aux: Skip hibernation attempts if hibernation is not configured

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: series starting with [1/1] igt_aux: Skip hibernation attempts if hibernation is not configured
URL : https://patchwork.freedesktop.org/series/35680/
State : success

== Summary ==

Test drv_suspend:

        Subgroup sysfs-reader-hibernate:
                fail       -> SKIP       (shard-snb) fdo#103375 +15
        Subgroup fence-restore-tiled2untiled:
                skip       -> PASS       (shard-snb)
        Subgroup sysfs-reader:
                skip       -> PASS       (shard-hsw)
Test gem_tiled_swapping:
        Subgroup non-threaded:
                incomplete -> PASS       (shard-snb) fdo#104218
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
                fail       -> PASS       (shard-snb) fdo#101623

fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623

shard-hsw        total:2712 pass:1537 dwarn:1   dfail:0   fail:3   skip:1171 time:9422s
shard-snb        total:2712 pass:1309 dwarn:1   dfail:0   fail:4   skip:1398 time:8113s
Blacklisted hosts:
shard-apl        total:2712 pass:1687 dwarn:2   dfail:0   fail:11  skip:1011 time:13539s
shard-kbl        total:2694 pass:1786 dwarn:2   dfail:0   fail:14  skip:891 time:10825s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_721/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx