[PATCH i-g-t] i915/suspend: Suspend once before taking forcewake to confirm suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 tests/i915/i915_suspend.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
index 47e134b12..83a4fa546 100644
--- a/tests/i915/i915_suspend.c
+++ b/tests/i915/i915_suspend.c
@@ -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);
 }
-- 
2.26.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux