Message ID | 20171221125341.29033-1-petri.latvala@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Quoting Petri Latvala (2017-12-21 12:53:41) > 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. > 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
Quoting Petri Latvala (2017-12-21 13:18:16) > On Thu, Dec 21, 2017 at 12:59:41PM +0000, Chris Wilson wrote: > > Quoting Petri Latvala (2017-12-21 12:53:41) > > > 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. > > > > > > 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? 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
diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 8ca0b60d..86d9c5b9 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -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);
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 Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Marta Lofstedt <marta.lofstedt@intel.com> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> --- lib/igt_aux.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)