@@ -186,17 +186,16 @@ test_shrink(int fd, unsigned int mode)
static void
test_forcewake(int fd, bool hibernate)
{
+ int suspend = hibernate ? SUSPEND_STATE_DISK : SUSPEND_STATE_MEM;
int fw_fd;
+ /* Once before to verify we can suspend */
+ igt_system_suspend_autoresume(suspend, SUSPEND_TEST_NONE);
+
fw_fd = igt_open_forcewake_handle(fd);
igt_assert_lte(0, fw_fd);
- if (hibernate)
- igt_system_suspend_autoresume(SUSPEND_STATE_DISK,
- SUSPEND_TEST_NONE);
- else
- igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
- SUSPEND_TEST_NONE);
+ igt_system_suspend_autoresume(suspend, SUSPEND_TEST_NONE);
close (fw_fd);
}
If we take the user-forcewake and then exit, we find outselves in a deadlock as the atexit handlers wait for our own forcewake to be released. We could either not use the automatically attached exit handler (__drm_open_driver), more carefully unwind the exit handler, or simply avoid doing late requirement checks. This patch does the later by testing for working suspend prior to taking the user-forcewake. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1637 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- tests/i915/i915_suspend.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)