* [PATCH igt 1/3] igt/gem_eio: Exercise set-wedging against request submission
@ 2018-03-13 12:31 Chris Wilson
2018-03-13 12:31 ` [PATCH igt 2/3] igt/gem_exec_fence: Exercise merging fences Chris Wilson
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Chris Wilson @ 2018-03-13 12:31 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev
Build up a large stockpile of requests, ~500,000, and feed them into the
system at 20KHz whilst simultaneously triggering set-wedged in order to
try and race i915_gem_set_wedged() against the engine->submit_request()
callback.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
tests/gem_eio.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
diff --git a/tests/gem_eio.c b/tests/gem_eio.c
index 249f5bff..a4bcee3d 100644
--- a/tests/gem_eio.c
+++ b/tests/gem_eio.c
@@ -34,12 +34,14 @@
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
+#include <signal.h>
#include <sys/ioctl.h>
#include <drm.h>
#include "igt.h"
#include "igt_sysfs.h"
+#include "i915/gem_ring.h"
#include "sw_sync.h"
IGT_TEST_DESCRIPTION("Test that specific ioctls report a wedged GPU (EIO).");
@@ -452,6 +454,107 @@ static void test_inflight_internal(int fd)
trigger_reset(fd);
}
+static void notify(union sigval arg)
+{
+ sw_sync_timeline_inc(arg.sival_int, 1);
+}
+
+static void test_set_wedged(int fd)
+{
+#define NCTX 4096
+ const uint32_t bbe = MI_BATCH_BUFFER_END;
+ const unsigned int ring_size = gem_measure_ring_inflight(fd, 0, 0) - 1;
+ struct drm_i915_gem_execbuffer2 execbuf;
+ struct drm_i915_gem_exec_object2 obj;
+ int dir = igt_debugfs_dir(fd);
+ struct itimerspec its;
+ struct sigevent sev;
+ uint32_t *contexts;
+ timer_t timer;
+ int timeline;
+ int syncpt;
+
+ contexts = calloc(NCTX, sizeof(*contexts));
+ igt_assert(contexts);
+
+ for (int n = 0; n < NCTX; n++)
+ contexts[n] = context_create_safe(fd);
+
+ memset(&obj, 0, sizeof(obj));
+ obj.handle = gem_create(fd, 4096);
+ gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
+
+ memset(&execbuf, 0, sizeof(execbuf));
+ execbuf.buffers_ptr = to_user_pointer(&obj);
+ execbuf.buffer_count = 1;
+ execbuf.flags = I915_EXEC_FENCE_IN;
+
+ for (unsigned int nctx = 1; nctx <= NCTX; nctx <<= 1) {
+ unsigned int nrq = ring_size;
+ if (!gem_has_execlists(fd)) {
+ nrq = (ring_size + nctx - 1) / nctx + 1;
+ nctx = ring_size / nrq;
+ }
+ igt_assert(nrq);
+ igt_assert(nctx);
+
+ timeline = sw_sync_timeline_create();
+
+ /* Build up a large orderly queue of requests */
+ syncpt = 1;
+ for (int m = 0; m < nrq; m++) {
+ for (int n = 0; n < nctx; n++) {
+ execbuf.rsvd1 = contexts[n];
+ execbuf.rsvd2 =
+ sw_sync_timeline_create_fence(timeline, syncpt);
+ gem_execbuf(fd, &execbuf);
+ close(execbuf.rsvd2);
+
+ syncpt++;
+ }
+ }
+ igt_debug("Queued %d requests over %d contexts\n",
+ syncpt, nctx);
+
+ igt_require(i915_reset_control(false));
+
+ /* Feed each request in at 20KHz */
+ memset(&sev, 0, sizeof(sev));
+ sev.sigev_notify = SIGEV_THREAD;
+ sev.sigev_value.sival_int = timeline;
+ sev.sigev_notify_function = notify;
+ igt_assert(timer_create(CLOCK_MONOTONIC, &sev, &timer) == 0);
+
+ memset(&its, 0, sizeof(its));
+ its.it_interval.tv_sec = 0;
+ its.it_interval.tv_nsec = 5000;
+ its.it_value = its.it_interval;
+ igt_assert(timer_settime(timer, 0, &its, NULL) == 0);
+ usleep(10);
+
+ igt_debug("Triggering wedge\n");
+ igt_sysfs_set(dir, "i915_wedged", "-1");
+
+ igt_debug("Disabling timer\n");
+ timer_delete(timer);
+ usleep(1000); /* timer_delete() doesn't flush pending signals */
+
+ igt_debug("Cleaning up\n");
+ close(timeline);
+
+ igt_assert(!gem_bo_busy(fd, obj.handle));
+
+ igt_assert(i915_reset_control(true));
+ trigger_reset(fd);
+ }
+
+ gem_close(fd, obj.handle);
+ for (int n = 0; n < NCTX; n++)
+ gem_context_destroy(fd, contexts[n]);
+ free(contexts);
+ close(dir);
+}
+
static int fd = -1;
static void
@@ -509,4 +612,9 @@ igt_main
igt_subtest("in-flight-suspend")
test_inflight_suspend(fd);
+
+ igt_subtest("set-wedged-racing") {
+ igt_require_sw_sync();
+ test_set_wedged(fd);
+ }
}
--
2.16.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH igt 2/3] igt/gem_exec_fence: Exercise merging fences 2018-03-13 12:31 [PATCH igt 1/3] igt/gem_eio: Exercise set-wedging against request submission Chris Wilson @ 2018-03-13 12:31 ` Chris Wilson 2018-03-16 22:11 ` [igt-dev] " Antonio Argenziano 2018-03-13 12:31 ` [PATCH igt 3/3] igt/gem_exec_schedule: Exercise "deep" preemption Chris Wilson 2018-03-16 21:12 ` [igt-dev] [PATCH igt 1/3] igt/gem_eio: Exercise set-wedging against request submission Antonio Argenziano 2 siblings, 1 reply; 7+ messages in thread From: Chris Wilson @ 2018-03-13 12:31 UTC (permalink / raw) To: intel-gfx; +Cc: igt-dev Execute the same batch on each engine and check that the composite fence across all engines completes only after the batch is completed on every engine. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- tests/gem_exec_fence.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c index 26bde788..95fc65e5 100644 --- a/tests/gem_exec_fence.c +++ b/tests/gem_exec_fence.c @@ -208,6 +208,113 @@ static void test_fence_busy(int fd, unsigned ring, unsigned flags) gem_quiescent_gpu(fd); } +static void test_fence_busy_all(int fd, unsigned flags) +{ + const int gen = intel_gen(intel_get_drm_devid(fd)); + struct drm_i915_gem_exec_object2 obj; + struct drm_i915_gem_relocation_entry reloc; + struct drm_i915_gem_execbuffer2 execbuf; + struct timespec tv; + uint32_t *batch; + unsigned int engine; + int all, i, timeout; + + gem_quiescent_gpu(fd); + + memset(&execbuf, 0, sizeof(execbuf)); + execbuf.buffers_ptr = to_user_pointer(&obj); + execbuf.buffer_count = 1; + + memset(&obj, 0, sizeof(obj)); + obj.handle = gem_create(fd, 4096); + + obj.relocs_ptr = to_user_pointer(&reloc); + obj.relocation_count = 1; + memset(&reloc, 0, sizeof(reloc)); + + batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE); + gem_set_domain(fd, obj.handle, + I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); + + reloc.target_handle = obj.handle; /* recurse */ + reloc.presumed_offset = 0; + reloc.offset = sizeof(uint32_t); + reloc.delta = 0; + reloc.read_domains = I915_GEM_DOMAIN_COMMAND; + reloc.write_domain = 0; + + i = 0; + batch[i] = MI_BATCH_BUFFER_START; + if (gen >= 8) { + batch[i] |= 1 << 8 | 1; + batch[++i] = 0; + batch[++i] = 0; + } else if (gen >= 6) { + batch[i] |= 1 << 8; + batch[++i] = 0; + } else { + batch[i] |= 2 << 6; + batch[++i] = 0; + if (gen < 4) { + batch[i] |= 1; + reloc.delta = 1; + } + } + i++; + + all = -1; + for_each_engine(fd, engine) { + int fence, new; + + execbuf.flags = engine | LOCAL_EXEC_FENCE_OUT; + execbuf.rsvd2 = -1; + gem_execbuf_wr(fd, &execbuf); + fence = execbuf.rsvd2 >> 32; + igt_assert(fence != -1); + + if (all < 0) { + all = fence; + break; + } + + new = sync_fence_merge(all, fence); + igt_assert_lte(0, new); + close(all); + close(fence); + + all = new; + } + + igt_assert(gem_bo_busy(fd, obj.handle)); + igt_assert(fence_busy(all)); + + timeout = 120; + if ((flags & HANG) == 0) { + *batch = MI_BATCH_BUFFER_END; + __sync_synchronize(); + timeout = 1; + } + munmap(batch, 4096); + + if (flags & WAIT) { + struct pollfd pfd = { .fd = all, .events = POLLIN }; + igt_assert(poll(&pfd, 1, timeout*1000) == 1); + } else { + memset(&tv, 0, sizeof(tv)); + while (fence_busy(all)) + igt_assert(igt_seconds_elapsed(&tv) < timeout); + } + + igt_assert(!gem_bo_busy(fd, obj.handle)); + igt_assert_eq(sync_fence_status(all), + flags & HANG ? -EIO : SYNC_FENCE_OK); + + close(all); + gem_close(fd, obj.handle); + + gem_quiescent_gpu(fd); +} + static void test_fence_await(int fd, unsigned ring, unsigned flags) { const int gen = intel_gen(intel_get_drm_devid(fd)); @@ -1465,6 +1572,26 @@ igt_main gem_submission_print_method(i915); } + igt_subtest_group { + igt_fixture { + igt_fork_hang_detector(i915); + } + + igt_subtest("basic-busy-all") + test_fence_busy_all(i915, 0); + igt_subtest("basic-wait-all") + test_fence_busy_all(i915, WAIT); + + igt_fixture { + igt_stop_hang_detector(); + } + + igt_subtest("busy-hang-all") + test_fence_busy_all(i915, HANG); + igt_subtest("wait-hang-all") + test_fence_busy_all(i915, WAIT | HANG); + } + for (e = intel_execution_engines; e->name; e++) { igt_subtest_group { igt_fixture { -- 2.16.2 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [igt-dev] [PATCH igt 2/3] igt/gem_exec_fence: Exercise merging fences 2018-03-13 12:31 ` [PATCH igt 2/3] igt/gem_exec_fence: Exercise merging fences Chris Wilson @ 2018-03-16 22:11 ` Antonio Argenziano 2018-03-16 22:14 ` Chris Wilson 0 siblings, 1 reply; 7+ messages in thread From: Antonio Argenziano @ 2018-03-16 22:11 UTC (permalink / raw) To: Chris Wilson, intel-gfx; +Cc: igt-dev On 13/03/18 05:31, Chris Wilson wrote: > Execute the same batch on each engine and check that the composite fence > across all engines completes only after the batch is completed on every > engine. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > --- > tests/gem_exec_fence.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 127 insertions(+) > > diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c > index 26bde788..95fc65e5 100644 > --- a/tests/gem_exec_fence.c > +++ b/tests/gem_exec_fence.c > @@ -208,6 +208,113 @@ static void test_fence_busy(int fd, unsigned ring, unsigned flags) > gem_quiescent_gpu(fd); > } > > +static void test_fence_busy_all(int fd, unsigned flags) > +{ > + const int gen = intel_gen(intel_get_drm_devid(fd)); > + struct drm_i915_gem_exec_object2 obj; > + struct drm_i915_gem_relocation_entry reloc; > + struct drm_i915_gem_execbuffer2 execbuf; > + struct timespec tv; > + uint32_t *batch; > + unsigned int engine; > + int all, i, timeout; > + > + gem_quiescent_gpu(fd); > + > + memset(&execbuf, 0, sizeof(execbuf)); > + execbuf.buffers_ptr = to_user_pointer(&obj); > + execbuf.buffer_count = 1; > + > + memset(&obj, 0, sizeof(obj)); > + obj.handle = gem_create(fd, 4096); > + > + obj.relocs_ptr = to_user_pointer(&reloc); > + obj.relocation_count = 1; > + memset(&reloc, 0, sizeof(reloc)); > + > + batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE); > + gem_set_domain(fd, obj.handle, > + I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); > + > + reloc.target_handle = obj.handle; /* recurse */ > + reloc.presumed_offset = 0; > + reloc.offset = sizeof(uint32_t); > + reloc.delta = 0; > + reloc.read_domains = I915_GEM_DOMAIN_COMMAND; > + reloc.write_domain = 0; > + > + i = 0; > + batch[i] = MI_BATCH_BUFFER_START; > + if (gen >= 8) { > + batch[i] |= 1 << 8 | 1; > + batch[++i] = 0; > + batch[++i] = 0; > + } else if (gen >= 6) { > + batch[i] |= 1 << 8; > + batch[++i] = 0; > + } else { > + batch[i] |= 2 << 6; > + batch[++i] = 0; > + if (gen < 4) { > + batch[i] |= 1; > + reloc.delta = 1; > + } > + } > + i++; > + > + all = -1; > + for_each_engine(fd, engine) { for_each_physical_engines to avoid submitting twice to the same engine. Other than that it LGTM. Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com> > + int fence, new; > + > + execbuf.flags = engine | LOCAL_EXEC_FENCE_OUT; > + execbuf.rsvd2 = -1; > + gem_execbuf_wr(fd, &execbuf); > + fence = execbuf.rsvd2 >> 32; > + igt_assert(fence != -1); > + > + if (all < 0) { > + all = fence; > + break; > + } > + > + new = sync_fence_merge(all, fence); > + igt_assert_lte(0, new); > + close(all); > + close(fence); > + > + all = new; > + } > + > + igt_assert(gem_bo_busy(fd, obj.handle)); > + igt_assert(fence_busy(all)); > + > + timeout = 120; > + if ((flags & HANG) == 0) { > + *batch = MI_BATCH_BUFFER_END; > + __sync_synchronize(); > + timeout = 1; > + } > + munmap(batch, 4096); > + > + if (flags & WAIT) { > + struct pollfd pfd = { .fd = all, .events = POLLIN }; > + igt_assert(poll(&pfd, 1, timeout*1000) == 1); > + } else { > + memset(&tv, 0, sizeof(tv)); > + while (fence_busy(all)) > + igt_assert(igt_seconds_elapsed(&tv) < timeout); > + } > + > + igt_assert(!gem_bo_busy(fd, obj.handle)); > + igt_assert_eq(sync_fence_status(all), > + flags & HANG ? -EIO : SYNC_FENCE_OK); > + > + close(all); > + gem_close(fd, obj.handle); > + > + gem_quiescent_gpu(fd); > +} > + > static void test_fence_await(int fd, unsigned ring, unsigned flags) > { > const int gen = intel_gen(intel_get_drm_devid(fd)); > @@ -1465,6 +1572,26 @@ igt_main > gem_submission_print_method(i915); > } > > + igt_subtest_group { > + igt_fixture { > + igt_fork_hang_detector(i915); > + } > + > + igt_subtest("basic-busy-all") > + test_fence_busy_all(i915, 0); > + igt_subtest("basic-wait-all") > + test_fence_busy_all(i915, WAIT); > + > + igt_fixture { > + igt_stop_hang_detector(); > + } > + > + igt_subtest("busy-hang-all") > + test_fence_busy_all(i915, HANG); > + igt_subtest("wait-hang-all") > + test_fence_busy_all(i915, WAIT | HANG); > + } > + > for (e = intel_execution_engines; e->name; e++) { > igt_subtest_group { > igt_fixture { > _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [igt-dev] [PATCH igt 2/3] igt/gem_exec_fence: Exercise merging fences 2018-03-16 22:11 ` [igt-dev] " Antonio Argenziano @ 2018-03-16 22:14 ` Chris Wilson 2018-03-16 22:21 ` Antonio Argenziano 0 siblings, 1 reply; 7+ messages in thread From: Chris Wilson @ 2018-03-16 22:14 UTC (permalink / raw) To: Antonio Argenziano, intel-gfx; +Cc: igt-dev Quoting Antonio Argenziano (2018-03-16 22:11:11) > > > On 13/03/18 05:31, Chris Wilson wrote: > > Execute the same batch on each engine and check that the composite fence > > across all engines completes only after the batch is completed on every > > engine. > > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > > --- > > tests/gem_exec_fence.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 127 insertions(+) > > > > diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c > > index 26bde788..95fc65e5 100644 > > --- a/tests/gem_exec_fence.c > > +++ b/tests/gem_exec_fence.c > > @@ -208,6 +208,113 @@ static void test_fence_busy(int fd, unsigned ring, unsigned flags) > > gem_quiescent_gpu(fd); > > } > > > > +static void test_fence_busy_all(int fd, unsigned flags) > > +{ > > + const int gen = intel_gen(intel_get_drm_devid(fd)); > > + struct drm_i915_gem_exec_object2 obj; > > + struct drm_i915_gem_relocation_entry reloc; > > + struct drm_i915_gem_execbuffer2 execbuf; > > + struct timespec tv; > > + uint32_t *batch; > > + unsigned int engine; > > + int all, i, timeout; > > + > > + gem_quiescent_gpu(fd); > > + > > + memset(&execbuf, 0, sizeof(execbuf)); > > + execbuf.buffers_ptr = to_user_pointer(&obj); > > + execbuf.buffer_count = 1; > > + > > + memset(&obj, 0, sizeof(obj)); > > + obj.handle = gem_create(fd, 4096); > > + > > + obj.relocs_ptr = to_user_pointer(&reloc); > > + obj.relocation_count = 1; > > + memset(&reloc, 0, sizeof(reloc)); > > + > > + batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE); > > + gem_set_domain(fd, obj.handle, > > + I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); > > + > > + reloc.target_handle = obj.handle; /* recurse */ > > + reloc.presumed_offset = 0; > > + reloc.offset = sizeof(uint32_t); > > + reloc.delta = 0; > > + reloc.read_domains = I915_GEM_DOMAIN_COMMAND; > > + reloc.write_domain = 0; > > + > > + i = 0; > > + batch[i] = MI_BATCH_BUFFER_START; > > + if (gen >= 8) { > > + batch[i] |= 1 << 8 | 1; > > + batch[++i] = 0; > > + batch[++i] = 0; > > + } else if (gen >= 6) { > > + batch[i] |= 1 << 8; > > + batch[++i] = 0; > > + } else { > > + batch[i] |= 2 << 6; > > + batch[++i] = 0; > > + if (gen < 4) { > > + batch[i] |= 1; > > + reloc.delta = 1; > > + } > > + } > > + i++; > > + > > + all = -1; > > + for_each_engine(fd, engine) { > > for_each_physical_engines to avoid submitting twice to the same engine. iirc, I thought about that in passing and decided that the ABI exercise was the intent here and not the HW exercise. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [igt-dev] [PATCH igt 2/3] igt/gem_exec_fence: Exercise merging fences 2018-03-16 22:14 ` Chris Wilson @ 2018-03-16 22:21 ` Antonio Argenziano 0 siblings, 0 replies; 7+ messages in thread From: Antonio Argenziano @ 2018-03-16 22:21 UTC (permalink / raw) To: Chris Wilson, intel-gfx; +Cc: igt-dev On 16/03/18 15:14, Chris Wilson wrote: > Quoting Antonio Argenziano (2018-03-16 22:11:11) >> >> >> On 13/03/18 05:31, Chris Wilson wrote: >>> Execute the same batch on each engine and check that the composite fence >>> across all engines completes only after the batch is completed on every >>> engine. >>> >>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> >>> --- >>> tests/gem_exec_fence.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++ >>> 1 file changed, 127 insertions(+) >>> >>> diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c >>> index 26bde788..95fc65e5 100644 >>> --- a/tests/gem_exec_fence.c >>> +++ b/tests/gem_exec_fence.c >>> @@ -208,6 +208,113 @@ static void test_fence_busy(int fd, unsigned ring, unsigned flags) >>> gem_quiescent_gpu(fd); >>> } >>> >>> +static void test_fence_busy_all(int fd, unsigned flags) >>> +{ >>> + const int gen = intel_gen(intel_get_drm_devid(fd)); >>> + struct drm_i915_gem_exec_object2 obj; >>> + struct drm_i915_gem_relocation_entry reloc; >>> + struct drm_i915_gem_execbuffer2 execbuf; >>> + struct timespec tv; >>> + uint32_t *batch; >>> + unsigned int engine; >>> + int all, i, timeout; >>> + >>> + gem_quiescent_gpu(fd); >>> + >>> + memset(&execbuf, 0, sizeof(execbuf)); >>> + execbuf.buffers_ptr = to_user_pointer(&obj); >>> + execbuf.buffer_count = 1; >>> + >>> + memset(&obj, 0, sizeof(obj)); >>> + obj.handle = gem_create(fd, 4096); >>> + >>> + obj.relocs_ptr = to_user_pointer(&reloc); >>> + obj.relocation_count = 1; >>> + memset(&reloc, 0, sizeof(reloc)); >>> + >>> + batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE); >>> + gem_set_domain(fd, obj.handle, >>> + I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); >>> + >>> + reloc.target_handle = obj.handle; /* recurse */ >>> + reloc.presumed_offset = 0; >>> + reloc.offset = sizeof(uint32_t); >>> + reloc.delta = 0; >>> + reloc.read_domains = I915_GEM_DOMAIN_COMMAND; >>> + reloc.write_domain = 0; >>> + >>> + i = 0; >>> + batch[i] = MI_BATCH_BUFFER_START; >>> + if (gen >= 8) { >>> + batch[i] |= 1 << 8 | 1; >>> + batch[++i] = 0; >>> + batch[++i] = 0; >>> + } else if (gen >= 6) { >>> + batch[i] |= 1 << 8; >>> + batch[++i] = 0; >>> + } else { >>> + batch[i] |= 2 << 6; >>> + batch[++i] = 0; >>> + if (gen < 4) { >>> + batch[i] |= 1; >>> + reloc.delta = 1; >>> + } >>> + } >>> + i++; >>> + >>> + all = -1; >>> + for_each_engine(fd, engine) { >> >> for_each_physical_engines to avoid submitting twice to the same engine. > > iirc, I thought about that in passing and decided that the ABI exercise > was the intent here and not the HW exercise. Makes sense, my RB stands then without the change. Thanks, Antonio > -Chris > _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH igt 3/3] igt/gem_exec_schedule: Exercise "deep" preemption 2018-03-13 12:31 [PATCH igt 1/3] igt/gem_eio: Exercise set-wedging against request submission Chris Wilson 2018-03-13 12:31 ` [PATCH igt 2/3] igt/gem_exec_fence: Exercise merging fences Chris Wilson @ 2018-03-13 12:31 ` Chris Wilson 2018-03-16 21:12 ` [igt-dev] [PATCH igt 1/3] igt/gem_eio: Exercise set-wedging against request submission Antonio Argenziano 2 siblings, 0 replies; 7+ messages in thread From: Chris Wilson @ 2018-03-13 12:31 UTC (permalink / raw) To: intel-gfx; +Cc: igt-dev, Mika Kuoppala In investigating the issue with having to force preemption within the executing ELSP[], we want to trigger preemption between all elements of that array. To that end, we issue a series of requests with different priorities to fill the in-flight ELSP[] and then demand preemption into the middle of that series. One can think of even more complicated reordering requirements of ELSP[], trying to switch between every possible combination of permutations. Rather than check all 2 billion combinations, be content with a few. v2: Add a different pattern for queued requests. Not only do we need to inject a request into the middle of a single context with a queue of different priority contexts, but we also want a queue of different contexts, as they have different patterns of ELSP[] behaviour. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mika Kuoppala <mika.kuoppala@intel.com> Cc: Michał Winiarski <michal.winiarski@intel.com> --- tests/gem_exec_schedule.c | 188 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 169 insertions(+), 19 deletions(-) diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c index 89cf4285..58fd9b1f 100644 --- a/tests/gem_exec_schedule.c +++ b/tests/gem_exec_schedule.c @@ -373,13 +373,78 @@ static void preempt(int fd, unsigned ring, unsigned flags) gem_close(fd, result); } -static void preempt_other(int fd, unsigned ring) +#define CHAIN 0x1 +#define CONTEXTS 0x2 + +static igt_spin_t *__noise(int fd, uint32_t ctx, int prio, igt_spin_t *spin) +{ + unsigned other; + + gem_context_set_priority(fd, ctx, prio); + + for_each_physical_engine(fd, other) { + if (spin == NULL) { + spin = __igt_spin_batch_new(fd, ctx, other, 0); + } else { + struct drm_i915_gem_exec_object2 obj = { + .handle = spin->handle, + }; + struct drm_i915_gem_execbuffer2 eb = { + .buffer_count = 1, + .buffers_ptr = to_user_pointer(&obj), + .rsvd1 = ctx, + .flags = other, + }; + gem_execbuf(fd, &eb); + } + } + + return spin; +} + +static void __preempt_other(int fd, + uint32_t *ctx, + unsigned int target, unsigned int primary, + unsigned flags) { uint32_t result = gem_create(fd, 4096); uint32_t *ptr = gem_mmap__gtt(fd, result, 4096, PROT_READ); - igt_spin_t *spin[MAX_ENGINES]; - unsigned int other; - unsigned int n, i; + unsigned int n, i, other; + + n = 0; + store_dword(fd, ctx[LO], primary, + result, (n + 1)*sizeof(uint32_t), n + 1, + 0, I915_GEM_DOMAIN_RENDER); + n++; + + if (flags & CHAIN) { + for_each_physical_engine(fd, other) { + store_dword(fd, ctx[LO], other, + result, (n + 1)*sizeof(uint32_t), n + 1, + 0, I915_GEM_DOMAIN_RENDER); + n++; + } + } + + store_dword(fd, ctx[HI], target, + result, (n + 1)*sizeof(uint32_t), n + 1, + 0, I915_GEM_DOMAIN_RENDER); + + igt_debugfs_dump(fd, "i915_engine_info"); + gem_set_domain(fd, result, I915_GEM_DOMAIN_GTT, 0); + + n++; + for (i = 0; i <= n; i++) + igt_assert_eq_u32(ptr[i], i); + + munmap(ptr, 4096); + gem_close(fd, result); +} + +static void preempt_other(int fd, unsigned ring, unsigned int flags) +{ + unsigned int primary; + igt_spin_t *spin = NULL; uint32_t ctx[3]; /* On each engine, insert @@ -396,36 +461,97 @@ static void preempt_other(int fd, unsigned ring) gem_context_set_priority(fd, ctx[LO], MIN_PRIO); ctx[NOISE] = gem_context_create(fd); + spin = __noise(fd, ctx[NOISE], 0, NULL); ctx[HI] = gem_context_create(fd); gem_context_set_priority(fd, ctx[HI], MAX_PRIO); + for_each_physical_engine(fd, primary) { + igt_debug("Primary engine: %s\n", e__->name); + __preempt_other(fd, ctx, ring, primary, flags); + + } + + igt_assert(gem_bo_busy(fd, spin->handle)); + igt_spin_batch_free(fd, spin); + + gem_context_destroy(fd, ctx[LO]); + gem_context_destroy(fd, ctx[NOISE]); + gem_context_destroy(fd, ctx[HI]); +} + +static void __preempt_queue(int fd, + unsigned target, unsigned primary, + unsigned depth, unsigned flags) +{ + uint32_t result = gem_create(fd, 4096); + uint32_t *ptr = gem_mmap__gtt(fd, result, 4096, PROT_READ); + igt_spin_t *above = NULL, *below = NULL; + unsigned int other, n, i; + int prio = MAX_PRIO; + uint32_t ctx[3] = { + gem_context_create(fd), + gem_context_create(fd), + gem_context_create(fd), + }; + + for (n = 0; n < depth; n++) { + if (flags & CONTEXTS) { + gem_context_destroy(fd, ctx[NOISE]); + ctx[NOISE] = gem_context_create(fd); + } + above = __noise(fd, ctx[NOISE], prio--, above); + } + + gem_context_set_priority(fd, ctx[HI], prio--); + + for (; n < MAX_ELSP_QLEN; n++) { + if (flags & CONTEXTS) { + gem_context_destroy(fd, ctx[NOISE]); + ctx[NOISE] = gem_context_create(fd); + } + below = __noise(fd, ctx[NOISE], prio--, below); + } + + gem_context_set_priority(fd, ctx[LO], prio--); + n = 0; - for_each_physical_engine(fd, other) { - igt_assert(n < ARRAY_SIZE(spin)); + store_dword(fd, ctx[LO], primary, + result, (n + 1)*sizeof(uint32_t), n + 1, + 0, I915_GEM_DOMAIN_RENDER); + n++; - spin[n] = __igt_spin_batch_new(fd, ctx[NOISE], other, 0); - store_dword(fd, ctx[LO], other, - result, (n + 1)*sizeof(uint32_t), n + 1, - 0, I915_GEM_DOMAIN_RENDER); - n++; + if (flags & CHAIN) { + for_each_physical_engine(fd, other) { + store_dword(fd, ctx[LO], other, + result, (n + 1)*sizeof(uint32_t), n + 1, + 0, I915_GEM_DOMAIN_RENDER); + n++; + } } - store_dword(fd, ctx[HI], ring, + + store_dword(fd, ctx[HI], target, result, (n + 1)*sizeof(uint32_t), n + 1, 0, I915_GEM_DOMAIN_RENDER); igt_debugfs_dump(fd, "i915_engine_info"); - gem_set_domain(fd, result, I915_GEM_DOMAIN_GTT, 0); - for (i = 0; i < n; i++) { - igt_assert(gem_bo_busy(fd, spin[i]->handle)); - igt_spin_batch_free(fd, spin[i]); + if (above) { + igt_assert(gem_bo_busy(fd, above->handle)); + igt_spin_batch_free(fd, above); } + gem_set_domain(fd, result, I915_GEM_DOMAIN_GTT, 0); + n++; for (i = 0; i <= n; i++) igt_assert_eq_u32(ptr[i], i); + if (below) { + igt_assert(gem_bo_busy(fd, below->handle)); + igt_spin_batch_free(fd, below); + } + gem_context_destroy(fd, ctx[LO]); gem_context_destroy(fd, ctx[NOISE]); gem_context_destroy(fd, ctx[HI]); @@ -434,6 +560,16 @@ static void preempt_other(int fd, unsigned ring) gem_close(fd, result); } +static void preempt_queue(int fd, unsigned ring, unsigned int flags) +{ + unsigned other; + + for_each_physical_engine(fd, other) { + for (unsigned depth = 0; depth <= MAX_ELSP_QLEN; depth++) + __preempt_queue(fd, ring, other, depth, flags); + } +} + static void preempt_self(int fd, unsigned ring) { uint32_t result = gem_create(fd, 4096); @@ -981,12 +1117,26 @@ igt_main igt_subtest_f("preempt-contexts-%s", e->name) preempt(fd, e->exec_id | e->flags, NEW_CTX); - igt_subtest_f("preempt-other-%s", e->name) - preempt_other(fd, e->exec_id | e->flags); - igt_subtest_f("preempt-self-%s", e->name) preempt_self(fd, e->exec_id | e->flags); + igt_subtest_f("preempt-other-%s", e->name) + preempt_other(fd, e->exec_id | e->flags, 0); + + igt_subtest_f("preempt-other-chain-%s", e->name) + preempt_other(fd, e->exec_id | e->flags, CHAIN); + + igt_subtest_f("preempt-queue-%s", e->name) + preempt_queue(fd, e->exec_id | e->flags, 0); + + igt_subtest_f("preempt-queue-chain-%s", e->name) + preempt_queue(fd, e->exec_id | e->flags, CHAIN); + igt_subtest_f("preempt-contexts-%s", e->name) + preempt_queue(fd, e->exec_id | e->flags, CONTEXTS); + + igt_subtest_f("preempt-contexts-chain-%s", e->name) + preempt_queue(fd, e->exec_id | e->flags, CONTEXTS | CHAIN); + igt_subtest_group { igt_hang_t hang; -- 2.16.2 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [igt-dev] [PATCH igt 1/3] igt/gem_eio: Exercise set-wedging against request submission 2018-03-13 12:31 [PATCH igt 1/3] igt/gem_eio: Exercise set-wedging against request submission Chris Wilson 2018-03-13 12:31 ` [PATCH igt 2/3] igt/gem_exec_fence: Exercise merging fences Chris Wilson 2018-03-13 12:31 ` [PATCH igt 3/3] igt/gem_exec_schedule: Exercise "deep" preemption Chris Wilson @ 2018-03-16 21:12 ` Antonio Argenziano 2 siblings, 0 replies; 7+ messages in thread From: Antonio Argenziano @ 2018-03-16 21:12 UTC (permalink / raw) To: Chris Wilson, intel-gfx; +Cc: igt-dev On 13/03/18 05:31, Chris Wilson wrote: > Build up a large stockpile of requests, ~500,000, and feed them into the > system at 20KHz whilst simultaneously triggering set-wedged in order to > try and race i915_gem_set_wedged() against the engine->submit_request() > callback. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> LGTM. Acked-by: Antonio Argenziano <antonio.argenziano@intel.com> > --- > tests/gem_eio.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 108 insertions(+) > _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-03-16 22:21 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-03-13 12:31 [PATCH igt 1/3] igt/gem_eio: Exercise set-wedging against request submission Chris Wilson 2018-03-13 12:31 ` [PATCH igt 2/3] igt/gem_exec_fence: Exercise merging fences Chris Wilson 2018-03-16 22:11 ` [igt-dev] " Antonio Argenziano 2018-03-16 22:14 ` Chris Wilson 2018-03-16 22:21 ` Antonio Argenziano 2018-03-13 12:31 ` [PATCH igt 3/3] igt/gem_exec_schedule: Exercise "deep" preemption Chris Wilson 2018-03-16 21:12 ` [igt-dev] [PATCH igt 1/3] igt/gem_eio: Exercise set-wedging against request submission Antonio Argenziano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox