Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang()
@ 2019-10-26 19:34 Chris Wilson
  2019-10-26 19:34 ` [Intel-gfx] " Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Chris Wilson @ 2019-10-26 19:34 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

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(-)

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);
-- 
2.24.0.rc1

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Intel-gfx] [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang()
  2019-10-26 19:34 [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang() Chris Wilson
@ 2019-10-26 19:34 ` Chris Wilson
  2019-10-26 19:34 ` [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck Chris Wilson
  2019-10-27 19:01 ` [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang() Andi Shyti
  2 siblings, 0 replies; 14+ messages in thread
From: Chris Wilson @ 2019-10-26 19:34 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

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(-)

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);
-- 
2.24.0.rc1

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-26 19:34 [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang() Chris Wilson
  2019-10-26 19:34 ` [Intel-gfx] " Chris Wilson
@ 2019-10-26 19:34 ` Chris Wilson
  2019-10-26 19:34   ` [Intel-gfx] " Chris Wilson
  2019-10-27 19:01   ` Andi Shyti
  2019-10-27 19:01 ` [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang() Andi Shyti
  2 siblings, 2 replies; 14+ messages in thread
From: Chris Wilson @ 2019-10-26 19:34 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Wrap the test inside igt_allow_hang as we depend upon a fast reset to
cancel the hostile context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_ctx_exec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/i915/gem_ctx_exec.c b/tests/i915/gem_ctx_exec.c
index b552edfbd..6b0092250 100644
--- a/tests/i915/gem_ctx_exec.c
+++ b/tests/i915/gem_ctx_exec.c
@@ -207,6 +207,7 @@ static void nohangcheck_hostile(int i915)
 {
 	int64_t timeout = NSEC_PER_SEC / 2;
 	igt_spin_t *spin;
+	igt_hang_t hang;
 	uint32_t ctx;
 	int err = 0;
 	int dir;
@@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
 	 * we forcibly terminate that context.
 	 */
 
+	hang = igt_allow_hang(i915, 0, 0);
+
 	dir = igt_sysfs_open_parameters(i915);
 	igt_require(dir != -1);
 
@@ -235,6 +238,7 @@ static void nohangcheck_hostile(int i915)
 
 	igt_require(__enable_hangcheck(dir, true));
 	gem_quiescent_gpu(i915);
+	igt_disallow_hang(i915, hang);
 
 	igt_assert_f(err == 0,
 		     "Hostile unpreemptable context was not cancelled immediately upon closure\n");
-- 
2.24.0.rc1

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-26 19:34 ` [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck Chris Wilson
@ 2019-10-26 19:34   ` Chris Wilson
  2019-10-27 19:01   ` Andi Shyti
  1 sibling, 0 replies; 14+ messages in thread
From: Chris Wilson @ 2019-10-26 19:34 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Wrap the test inside igt_allow_hang as we depend upon a fast reset to
cancel the hostile context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_ctx_exec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/i915/gem_ctx_exec.c b/tests/i915/gem_ctx_exec.c
index b552edfbd..6b0092250 100644
--- a/tests/i915/gem_ctx_exec.c
+++ b/tests/i915/gem_ctx_exec.c
@@ -207,6 +207,7 @@ static void nohangcheck_hostile(int i915)
 {
 	int64_t timeout = NSEC_PER_SEC / 2;
 	igt_spin_t *spin;
+	igt_hang_t hang;
 	uint32_t ctx;
 	int err = 0;
 	int dir;
@@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
 	 * we forcibly terminate that context.
 	 */
 
+	hang = igt_allow_hang(i915, 0, 0);
+
 	dir = igt_sysfs_open_parameters(i915);
 	igt_require(dir != -1);
 
@@ -235,6 +238,7 @@ static void nohangcheck_hostile(int i915)
 
 	igt_require(__enable_hangcheck(dir, true));
 	gem_quiescent_gpu(i915);
+	igt_disallow_hang(i915, hang);
 
 	igt_assert_f(err == 0,
 		     "Hostile unpreemptable context was not cancelled immediately upon closure\n");
-- 
2.24.0.rc1

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang()
  2019-10-26 19:34 [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang() Chris Wilson
  2019-10-26 19:34 ` [Intel-gfx] " Chris Wilson
  2019-10-26 19:34 ` [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck Chris Wilson
@ 2019-10-27 19:01 ` Andi Shyti
  2019-10-27 19:01   ` [Intel-gfx] " Andi Shyti
  2 siblings, 1 reply; 14+ messages in thread
From: Andi Shyti @ 2019-10-27 19:01 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang()
  2019-10-27 19:01 ` [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang() Andi Shyti
@ 2019-10-27 19:01   ` Andi Shyti
  0 siblings, 0 replies; 14+ messages in thread
From: Andi Shyti @ 2019-10-27 19:01 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-26 19:34 ` [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck Chris Wilson
  2019-10-26 19:34   ` [Intel-gfx] " Chris Wilson
@ 2019-10-27 19:01   ` Andi Shyti
  2019-10-27 19:01     ` [Intel-gfx] " Andi Shyti
                       ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Andi Shyti @ 2019-10-27 19:01 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

Hi Chris,

> @@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
>  	 * we forcibly terminate that context.
>  	 */
>  
> +	hang = igt_allow_hang(i915, 0, 0);
> +

why ctx = 0?

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-27 19:01   ` Andi Shyti
@ 2019-10-27 19:01     ` Andi Shyti
  2019-10-27 19:05     ` Chris Wilson
  2019-10-27 19:06     ` Chris Wilson
  2 siblings, 0 replies; 14+ messages in thread
From: Andi Shyti @ 2019-10-27 19:01 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

Hi Chris,

> @@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
>  	 * we forcibly terminate that context.
>  	 */
>  
> +	hang = igt_allow_hang(i915, 0, 0);
> +

why ctx = 0?

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-27 19:01   ` Andi Shyti
  2019-10-27 19:01     ` [Intel-gfx] " Andi Shyti
@ 2019-10-27 19:05     ` Chris Wilson
  2019-10-27 19:05       ` [Intel-gfx] " Chris Wilson
  2019-10-27 19:33       ` Andi Shyti
  2019-10-27 19:06     ` Chris Wilson
  2 siblings, 2 replies; 14+ messages in thread
From: Chris Wilson @ 2019-10-27 19:05 UTC (permalink / raw)
  To: Andi Shyti; +Cc: igt-dev, intel-gfx

Quoting Andi Shyti (2019-10-27 19:01:24)
> Hi Chris,
> 
> > @@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
> >        * we forcibly terminate that context.
> >        */
> >  
> > +     hang = igt_allow_hang(i915, 0, 0);
> > +
> 
> why ctx = 0?

Because I'm lazy and it didn't matter ;)
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-27 19:05     ` Chris Wilson
@ 2019-10-27 19:05       ` Chris Wilson
  2019-10-27 19:33       ` Andi Shyti
  1 sibling, 0 replies; 14+ messages in thread
From: Chris Wilson @ 2019-10-27 19:05 UTC (permalink / raw)
  To: Andi Shyti; +Cc: igt-dev, intel-gfx

Quoting Andi Shyti (2019-10-27 19:01:24)
> Hi Chris,
> 
> > @@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
> >        * we forcibly terminate that context.
> >        */
> >  
> > +     hang = igt_allow_hang(i915, 0, 0);
> > +
> 
> why ctx = 0?

Because I'm lazy and it didn't matter ;)
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-27 19:01   ` Andi Shyti
  2019-10-27 19:01     ` [Intel-gfx] " Andi Shyti
  2019-10-27 19:05     ` Chris Wilson
@ 2019-10-27 19:06     ` Chris Wilson
  2019-10-27 19:06       ` [Intel-gfx] " Chris Wilson
  2 siblings, 1 reply; 14+ messages in thread
From: Chris Wilson @ 2019-10-27 19:06 UTC (permalink / raw)
  To: Andi Shyti; +Cc: igt-dev, intel-gfx

Quoting Andi Shyti (2019-10-27 19:01:24)
> Hi Chris,
> 
> > @@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
> >        * we forcibly terminate that context.
> >        */
> >  
> > +     hang = igt_allow_hang(i915, 0, 0);
> > +
> 
> why ctx = 0?

Imagine,

         * we forcibly terminate that context.
         */

-       hang = igt_allow_hang(i915, 0, 0);
-
        dir = igt_sysfs_open_parameters(i915);
        igt_require(dir != -1);

        ctx = gem_context_create(i915);
+       hang = igt_allow_hang(i915, ctx, 0);

        igt_require(__enable_hangcheck(dir, false));
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-27 19:06     ` Chris Wilson
@ 2019-10-27 19:06       ` Chris Wilson
  0 siblings, 0 replies; 14+ messages in thread
From: Chris Wilson @ 2019-10-27 19:06 UTC (permalink / raw)
  To: Andi Shyti; +Cc: igt-dev, intel-gfx

Quoting Andi Shyti (2019-10-27 19:01:24)
> Hi Chris,
> 
> > @@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
> >        * we forcibly terminate that context.
> >        */
> >  
> > +     hang = igt_allow_hang(i915, 0, 0);
> > +
> 
> why ctx = 0?

Imagine,

         * we forcibly terminate that context.
         */

-       hang = igt_allow_hang(i915, 0, 0);
-
        dir = igt_sysfs_open_parameters(i915);
        igt_require(dir != -1);

        ctx = gem_context_create(i915);
+       hang = igt_allow_hang(i915, ctx, 0);

        igt_require(__enable_hangcheck(dir, false));
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-27 19:05     ` Chris Wilson
  2019-10-27 19:05       ` [Intel-gfx] " Chris Wilson
@ 2019-10-27 19:33       ` Andi Shyti
  2019-10-27 19:33         ` [Intel-gfx] " Andi Shyti
  1 sibling, 1 reply; 14+ messages in thread
From: Andi Shyti @ 2019-10-27 19:33 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

> > > @@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
> > >        * we forcibly terminate that context.
> > >        */
> > >  
> > > +     hang = igt_allow_hang(i915, 0, 0);
> > > +
> > 
> > why ctx = 0?
> 
> Because I'm lazy and it didn't matter ;)

yes, sure :)

Acked-by: Andi Shyti <andi.shyti@intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck
  2019-10-27 19:33       ` Andi Shyti
@ 2019-10-27 19:33         ` Andi Shyti
  0 siblings, 0 replies; 14+ messages in thread
From: Andi Shyti @ 2019-10-27 19:33 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

> > > @@ -216,6 +217,8 @@ static void nohangcheck_hostile(int i915)
> > >        * we forcibly terminate that context.
> > >        */
> > >  
> > > +     hang = igt_allow_hang(i915, 0, 0);
> > > +
> > 
> > why ctx = 0?
> 
> Because I'm lazy and it didn't matter ;)

yes, sure :)

Acked-by: Andi Shyti <andi.shyti@intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-10-27 19:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-26 19:34 [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang() Chris Wilson
2019-10-26 19:34 ` [Intel-gfx] " Chris Wilson
2019-10-26 19:34 ` [PATCH i-g-t 2/2] i915/gem_ctx_exec: Enable resets for basic-nohangcheck Chris Wilson
2019-10-26 19:34   ` [Intel-gfx] " Chris Wilson
2019-10-27 19:01   ` Andi Shyti
2019-10-27 19:01     ` [Intel-gfx] " Andi Shyti
2019-10-27 19:05     ` Chris Wilson
2019-10-27 19:05       ` [Intel-gfx] " Chris Wilson
2019-10-27 19:33       ` Andi Shyti
2019-10-27 19:33         ` [Intel-gfx] " Andi Shyti
2019-10-27 19:06     ` Chris Wilson
2019-10-27 19:06       ` [Intel-gfx] " Chris Wilson
2019-10-27 19:01 ` [PATCH i-g-t 1/2] lib: Restore i915.reset before testing it in igt_allow_hang() Andi Shyti
2019-10-27 19:01   ` [Intel-gfx] " Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox