From: John.C.Harrison@Intel.com
To: IGT-Dev@Lists.FreeDesktop.Org
Cc: Intel-GFX@Lists.FreeDesktop.Org,
John Harrison <John.C.Harrison@Intel.com>
Subject: [Intel-gfx] [PATCH i-g-t 7/8] lib/igt_gt: Allow per engine reset testing
Date: Thu, 21 Oct 2021 16:40:43 -0700 [thread overview]
Message-ID: <20211021234044.3071069-8-John.C.Harrison@Intel.com> (raw)
In-Reply-To: <20211021234044.3071069-1-John.C.Harrison@Intel.com>
From: John Harrison <John.C.Harrison@Intel.com>
With GuC submission, engine resets are handled entirely within GuC
rather than within i915. Traditionally, IGT has disallowed engine
based resets becuase they don't send the uevent which IGT uses to
check for unexpected resets. However, it is important to be able to
test all reset mechanisms that can be used, so allow engine based
resets to be enabled.
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
---
lib/igt_gt.c | 44 +++++++++++++++++++++++++++++---------------
lib/igt_gt.h | 1 +
2 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index a0ba04cc1..7c7df95ee 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -56,23 +56,28 @@
* engines.
*/
+static int reset_query_once = -1;
+
static bool has_gpu_reset(int fd)
{
- static int once = -1;
- if (once < 0) {
- struct drm_i915_getparam gp;
- int val = 0;
-
- memset(&gp, 0, sizeof(gp));
- gp.param = 35; /* HAS_GPU_RESET */
- gp.value = &val;
-
- if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp))
- once = intel_gen(intel_get_drm_devid(fd)) >= 5;
- else
- once = val > 0;
+ if (reset_query_once < 0) {
+ reset_query_once = gem_gpu_reset_type(fd);
+
+ /* Very old kernels did not support the query */
+ if (reset_query_once == -1)
+ reset_query_once =
+ (intel_gen(intel_get_drm_devid(fd)) >= 5) ? 1 : 0;
}
- return once;
+
+ return reset_query_once > 0;
+}
+
+static bool has_engine_reset(int fd)
+{
+ if (reset_query_once < 0)
+ has_gpu_reset(fd);
+
+ return reset_query_once > 1;
}
static void eat_error_state(int dev)
@@ -176,7 +181,11 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
igt_skip("hang injection disabled by user [IGT_HANG=0]\n");
gem_context_require_bannable(fd);
- allow_reset = 1;
+ if (flags & HANG_WANT_ENGINE_RESET)
+ allow_reset = 2;
+ else
+ allow_reset = 1;
+
if ((flags & HANG_ALLOW_CAPTURE) == 0) {
param.param = I915_CONTEXT_PARAM_NO_ERROR_CAPTURE;
param.value = 1;
@@ -187,11 +196,16 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
__gem_context_set_param(fd, ¶m);
allow_reset = INT_MAX; /* any reset method */
}
+
igt_require(igt_params_set(fd, "reset", "%d", allow_reset));
+ reset_query_once = -1; /* Re-query after changing param */
if (!igt_check_boolean_env_var("IGT_HANG_WITHOUT_RESET", false))
igt_require(has_gpu_reset(fd));
+ if (flags & HANG_WANT_ENGINE_RESET)
+ igt_require(has_engine_reset(fd));
+
ban = context_get_ban(fd, ctx);
if ((flags & HANG_ALLOW_BAN) == 0)
context_set_ban(fd, ctx, 0);
diff --git a/lib/igt_gt.h b/lib/igt_gt.h
index ceb044b86..c5059817b 100644
--- a/lib/igt_gt.h
+++ b/lib/igt_gt.h
@@ -51,6 +51,7 @@ igt_hang_t igt_hang_ctx_with_ahnd(int fd, uint64_t ahnd, uint32_t ctx, int ring,
#define HANG_ALLOW_BAN 1
#define HANG_ALLOW_CAPTURE 2
+#define HANG_WANT_ENGINE_RESET 4
igt_hang_t igt_hang_ring(int fd, int ring);
igt_hang_t igt_hang_ring_with_ahnd(int fd, int ring, uint64_t ahnd);
--
2.25.1
next prev parent reply other threads:[~2021-10-21 23:41 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 23:40 [Intel-gfx] [PATCH i-g-t 0/8] Fixes for gem_exec_capture John.C.Harrison
2021-10-21 23:40 ` [Intel-gfx] [PATCH i-g-t 1/8] tests/i915/gem_exec_capture: Remove pointless assert John.C.Harrison
2021-10-29 2:14 ` [Intel-gfx] [igt-dev] " Matthew Brost
2021-11-03 13:50 ` [Intel-gfx] " Tvrtko Ursulin
2021-11-03 18:44 ` John Harrison
2021-11-04 9:14 ` Tvrtko Ursulin
2021-10-21 23:40 ` [Intel-gfx] [PATCH i-g-t 2/8] tests/i915/gem_exec_capture: Cope with larger page sizes John.C.Harrison
2021-10-29 17:39 ` [Intel-gfx] [igt-dev] " Matthew Brost
2021-10-30 0:32 ` John Harrison
2021-11-02 23:18 ` Matthew Brost
2021-10-21 23:40 ` [Intel-gfx] [PATCH i-g-t 3/8] tests/i915/gem_exec_capture: Make the error decode a common helper John.C.Harrison
2021-10-29 2:34 ` Matthew Brost
2021-10-21 23:40 ` [Intel-gfx] [PATCH i-g-t 4/8] tests/i915/gem_exec_capture: Use contexts and engines properly John.C.Harrison
2021-11-02 23:34 ` Matthew Brost
2021-11-03 1:45 ` John Harrison
2021-11-03 9:36 ` Petri Latvala
2021-11-03 18:49 ` John Harrison
2021-11-04 6:40 ` Petri Latvala
2021-10-21 23:40 ` [Intel-gfx] [PATCH i-g-t 5/8] tests/i915/gem_exec_capture: Check for memory allocation failure John.C.Harrison
2021-10-29 2:20 ` Matthew Brost
2021-11-03 14:00 ` Tvrtko Ursulin
2021-11-03 18:36 ` John Harrison
2021-10-21 23:40 ` [Intel-gfx] [PATCH i-g-t 6/8] lib/igt_sysfs: Support large files John.C.Harrison
2021-10-29 2:46 ` [Intel-gfx] [igt-dev] " Matthew Brost
2021-10-21 23:40 ` John.C.Harrison [this message]
2021-11-03 0:47 ` [Intel-gfx] [PATCH i-g-t 7/8] lib/igt_gt: Allow per engine reset testing Matthew Brost
2021-10-21 23:40 ` [Intel-gfx] [PATCH i-g-t 8/8] tests/i915/gem_exec_capture: Update to support GuC based resets John.C.Harrison
2021-10-29 2:54 ` Matthew Brost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211021234044.3071069-8-John.C.Harrison@Intel.com \
--to=john.c.harrison@intel.com \
--cc=IGT-Dev@Lists.FreeDesktop.Org \
--cc=Intel-GFX@Lists.FreeDesktop.Org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox