diff mbox series

[i-g-t,1/2] lib: Restore i915.reset before testing it in igt_allow_hang()

Message ID 20191026193456.19445-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [i-g-t,1/2] lib: Restore i915.reset before testing it in igt_allow_hang() | expand

Commit Message

Chris Wilson Oct. 26, 2019, 7:34 p.m. UTC
igt_allow_hang() checks that the GPU can be reset before allowing the
test to cause a GPU hang (which would need the reset to recover).
However, our checking for allowing a hang depends on i915.reset which we
later restore. Do that restoration before the check so that this test is
not affected by earlier fails.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_gt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Andi Shyti Oct. 27, 2019, 7:01 p.m. UTC | #1
Hi Chris,

On Sat, Oct 26, 2019 at 08:34:55PM +0100, Chris Wilson wrote:
> igt_allow_hang() checks that the GPU can be reset before allowing the
> test to cause a GPU hang (which would need the reset to recover).
> However, our checking for allowing a hang depends on i915.reset which we
> later restore. Do that restoration before the check so that this test is
> not affected by earlier fails.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Acked-by: Andi Shyti <andi.shyti@intel.com>

Andi
diff mbox series

Patch

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 5ca77471c..256c7cbc0 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -175,8 +175,6 @@  igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
 	if (!igt_check_boolean_env_var("IGT_HANG", true))
 		igt_skip("hang injection disabled by user");
 	gem_context_require_bannable(fd);
-	if (!igt_check_boolean_env_var("IGT_HANG_WITHOUT_RESET", false))
-		igt_require(has_gpu_reset(fd));
 
 	allow_reset = 1;
 	if ((flags & HANG_ALLOW_CAPTURE) == 0) {
@@ -191,6 +189,9 @@  igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
 	}
 	igt_require(igt_sysfs_set_parameter(fd, "reset", "%d", allow_reset));
 
+	if (!igt_check_boolean_env_var("IGT_HANG_WITHOUT_RESET", false))
+		igt_require(has_gpu_reset(fd));
+
 	ban = context_get_ban(fd, ctx);
 	if ((flags & HANG_ALLOW_BAN) == 0)
 		context_set_ban(fd, ctx, 0);