* [PATCH i-g-t] i915: Exercise hostile context execution
@ 2019-10-22 15:47 Chris Wilson
2019-10-23 12:50 ` [igt-dev] " Andi Shyti
0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2019-10-22 15:47 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev
Verify that contexts are automatically shotdown on close if hangchecking
is disabled.
Basic environmental robustness test stolen from gem_ctx_persistence.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jon Bloomfield <jon.bloomfield@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/i915/gem_ctx_exec.c | 41 +++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/tests/i915/gem_ctx_exec.c b/tests/i915/gem_ctx_exec.c
index 614a9f401..92e899869 100644
--- a/tests/i915/gem_ctx_exec.c
+++ b/tests/i915/gem_ctx_exec.c
@@ -40,6 +40,8 @@
#include <drm.h>
+#include "igt_dummyload.h"
+#include "igt_sysfs.h"
IGT_TEST_DESCRIPTION("Test context batch buffer execution.");
@@ -196,6 +198,42 @@ static void norecovery(int i915)
igt_disallow_hang(i915, hang);
}
+static bool __enable_hangcheck(int dir, bool state)
+{
+ return igt_sysfs_set(dir, "enable_hangcheck", state ? "1" : "0");
+}
+
+static void nohangcheck_hostile(int i915)
+{
+ int64_t timeout = NSEC_PER_SEC / 2;
+ igt_spin_t *spin;
+ uint32_t ctx;
+ int dir;
+
+ /*
+ * Even if the user disables hangcheck during their context,
+ * we forcibly terminate that context.
+ */
+
+ dir = igt_sysfs_open_parameters(i915);
+ igt_require(dir != -1);
+
+ ctx = gem_context_create(i915);
+
+ igt_require(__enable_hangcheck(dir, false));
+
+ spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_NO_PREEMPTION);
+ gem_context_destroy(i915, ctx);
+
+ igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0);
+
+ igt_require(__enable_hangcheck(dir, true));
+
+ igt_spin_free(i915, spin);
+ gem_quiescent_gpu(i915);
+ close(dir);
+}
+
igt_main
{
const uint32_t batch[2] = { 0, MI_BATCH_BUFFER_END };
@@ -239,6 +277,9 @@ igt_main
igt_subtest("basic-norecovery")
norecovery(fd);
+ igt_subtest("basic-nohangcheck")
+ nohangcheck_hostile(fd);
+
igt_subtest("reset-pin-leak") {
int i;
--
2.24.0.rc0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [igt-dev] [PATCH i-g-t] i915: Exercise hostile context execution
2019-10-22 15:47 [PATCH i-g-t] i915: Exercise hostile context execution Chris Wilson
@ 2019-10-23 12:50 ` Andi Shyti
2019-10-23 12:50 ` [Intel-gfx] " Andi Shyti
0 siblings, 1 reply; 3+ messages in thread
From: Andi Shyti @ 2019-10-23 12:50 UTC (permalink / raw)
To: Chris Wilson; +Cc: igt-dev, intel-gfx
Hi Chris,
On Tue, Oct 22, 2019 at 04:47:48PM +0100, Chris Wilson wrote:
> Verify that contexts are automatically shotdown on close if hangchecking
> is disabled.
>
> Basic environmental robustness test stolen from gem_ctx_persistence.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jon Bloomfield <jon.bloomfield@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
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] 3+ messages in thread
* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] i915: Exercise hostile context execution
2019-10-23 12:50 ` [igt-dev] " Andi Shyti
@ 2019-10-23 12:50 ` Andi Shyti
0 siblings, 0 replies; 3+ messages in thread
From: Andi Shyti @ 2019-10-23 12:50 UTC (permalink / raw)
To: Chris Wilson; +Cc: igt-dev, intel-gfx
Hi Chris,
On Tue, Oct 22, 2019 at 04:47:48PM +0100, Chris Wilson wrote:
> Verify that contexts are automatically shotdown on close if hangchecking
> is disabled.
>
> Basic environmental robustness test stolen from gem_ctx_persistence.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jon Bloomfield <jon.bloomfield@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
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] 3+ messages in thread
end of thread, other threads:[~2019-10-23 12:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-22 15:47 [PATCH i-g-t] i915: Exercise hostile context execution Chris Wilson
2019-10-23 12:50 ` [igt-dev] " Andi Shyti
2019-10-23 12:50 ` [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