From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] kms_busy: Replace fiddling with hangcheck modparam with explicit fence
Date: Sat, 27 Jul 2019 19:02:47 +0100 [thread overview]
Message-ID: <20190727180247.28311-1-chris@chris-wilson.co.uk> (raw)
Use an explicit fence to circumvent the [i915] GPU hang detection rather
than tweak the i915 specific modparam (and remove the assertion that
such a param exists). Note, that with a bit more work, the fence could
be used be directly rather than via dirtying the fb with a dummyload.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
lib/igt_dummyload.c | 5 +++++
lib/igt_dummyload.h | 10 ++++++----
tests/kms_busy.c | 26 ++++++++++----------------
3 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 0e06276af..65b5cc927 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -236,6 +236,11 @@ emit_recursive_batch(igt_spin_t *spin,
if (opts->flags & IGT_SPIN_FENCE_OUT)
execbuf->flags |= I915_EXEC_FENCE_OUT;
+ if (opts->flags & IGT_SPIN_FENCE_IN) {
+ execbuf->flags |= I915_EXEC_FENCE_IN;
+ execbuf->rsvd2 = opts->fence;
+ }
+
for (i = 0; i < nengine; i++) {
execbuf->flags &= ~ENGINE_MASK;
execbuf->flags |= flags[i];
diff --git a/lib/igt_dummyload.h b/lib/igt_dummyload.h
index bb25751ad..66837057d 100644
--- a/lib/igt_dummyload.h
+++ b/lib/igt_dummyload.h
@@ -54,12 +54,14 @@ struct igt_spin_factory {
uint32_t dependency;
unsigned int engine;
unsigned int flags;
+ int fence;
};
-#define IGT_SPIN_FENCE_OUT (1 << 0)
-#define IGT_SPIN_POLL_RUN (1 << 1)
-#define IGT_SPIN_FAST (1 << 2)
-#define IGT_SPIN_NO_PREEMPTION (1 << 3)
+#define IGT_SPIN_FENCE_IN (1 << 0)
+#define IGT_SPIN_FENCE_OUT (1 << 1)
+#define IGT_SPIN_POLL_RUN (1 << 2)
+#define IGT_SPIN_FAST (1 << 3)
+#define IGT_SPIN_NO_PREEMPTION (1 << 4)
igt_spin_t *
__igt_spin_factory(int fd, const struct igt_spin_factory *opts);
diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index 66f26cd08..baf45f30f 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -75,22 +75,16 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
struct pollfd pfd = { .fd = dpy->drm_fd, .events = POLLIN };
const int timeout = modeset ? 8500 : 100;
struct drm_event_vblank ev;
+ IGT_CORK_FENCE(cork);
+ igt_spin_t *t;
+ int fence;
- igt_spin_t *t = igt_spin_new(dpy->drm_fd,
- .engine = ring,
- .dependency = fb->gem_handle);
-
- if (modeset) {
- /*
- * We want to check that a modeset actually waits for the
- * spin batch to complete, but we keep a bigger timeout for
- * disable than required for flipping.
- *
- * As a result, the GPU reset code may kick in, which we neuter
- * here to be sure there's no premature completion.
- */
- igt_set_module_param_int("enable_hangcheck", 0);
- }
+ fence = igt_cork_plug(&cork, dpy->drm_fd);
+ t = igt_spin_new(dpy->drm_fd,
+ .engine = ring,
+ .fence = fence,
+ .dependency = fb->gem_handle,
+ .flags = IGT_SPIN_FENCE_IN | IGT_SPIN_NO_PREEMPTION);
igt_fork(child, 1) {
igt_assert(gem_bo_busy(dpy->drm_fd, fb->gem_handle));
@@ -116,13 +110,13 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,
igt_waitchildren_timeout(5 * timeout,
"flip blocked waiting for busy bo\n");
igt_spin_end(t);
+ close(fence);
igt_assert(read(dpy->drm_fd, &ev, sizeof(ev)) == sizeof(ev));
igt_assert(poll(&pfd, 1, 0) == 0);
if (modeset) {
gem_quiescent_gpu(dpy->drm_fd);
- igt_set_module_param_int("enable_hangcheck", 1);
/* Clear old mode blob. */
igt_pipe_refresh(dpy, pipe, true);
--
2.22.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-07-27 18:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-27 18:02 Chris Wilson [this message]
2019-07-28 2:40 ` [igt-dev] ✓ Fi.CI.BAT: success for kms_busy: Replace fiddling with hangcheck modparam with explicit fence Patchwork
2019-07-29 11:45 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=20190727180247.28311-1-chris@chris-wilson.co.uk \
--to=chris@chris-wilson.co.uk \
--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