From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Cc: igt-dev@lists.freedesktop.org Subject: [PATCH igt] igt/gem_eio: Exercise set-wedging against request submission Date: Sat, 17 Mar 2018 09:09:01 +0000 [thread overview] Message-ID: <20180317090901.2656-1-chris@chris-wilson.co.uk> (raw) In-Reply-To: <20180316220234.1603-1-chris@chris-wilson.co.uk> 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. v2: Tweak sleep for flushing timer signals. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> Acked-by: Antonio Argenziano <antonio.argenziano@intel.com> --- tests/gem_eio.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/tests/gem_eio.c b/tests/gem_eio.c index 249f5bff..ff3df7b6 100644 --- a/tests/gem_eio.c +++ b/tests/gem_eio.c @@ -34,12 +34,15 @@ #include <fcntl.h> #include <inttypes.h> #include <errno.h> +#include <sched.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 +455,108 @@ 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 + 1; + } + 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(10000);/* timer_delete() doesn't flush pending signals */ + + igt_debug("Cleaning up\n"); + close(timeline); + + sched_yield(); + 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 +614,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
WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Cc: igt-dev@lists.freedesktop.org, Mika Kuoppala <mika.kuoppala@linux.intel.com> Subject: [igt-dev] [PATCH igt] igt/gem_eio: Exercise set-wedging against request submission Date: Sat, 17 Mar 2018 09:09:01 +0000 [thread overview] Message-ID: <20180317090901.2656-1-chris@chris-wilson.co.uk> (raw) In-Reply-To: <20180316220234.1603-1-chris@chris-wilson.co.uk> 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. v2: Tweak sleep for flushing timer signals. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> Acked-by: Antonio Argenziano <antonio.argenziano@intel.com> --- tests/gem_eio.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/tests/gem_eio.c b/tests/gem_eio.c index 249f5bff..ff3df7b6 100644 --- a/tests/gem_eio.c +++ b/tests/gem_eio.c @@ -34,12 +34,15 @@ #include <fcntl.h> #include <inttypes.h> #include <errno.h> +#include <sched.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 +455,108 @@ 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 + 1; + } + 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(10000);/* timer_delete() doesn't flush pending signals */ + + igt_debug("Cleaning up\n"); + close(timeline); + + sched_yield(); + 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 +614,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 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2018-03-17 9:09 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-16 22:02 [PATCH igt] igt/gem_eio: Exercise set-wedging against request submission Chris Wilson 2018-03-16 22:02 ` [igt-dev] " Chris Wilson 2018-03-16 23:19 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/gem_eio: Exercise set-wedging against request submission (rev2) Patchwork 2018-03-17 5:17 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork 2018-03-17 9:09 ` Chris Wilson [this message] 2018-03-17 9:09 ` [igt-dev] [PATCH igt] igt/gem_eio: Exercise set-wedging against request submission Chris Wilson -- strict thread matches above, loose matches on Subject: below -- 2018-03-08 12:17 Chris Wilson 2018-02-06 23:25 [PATCH igt] igt/gem_eio: Use slow spinners to inject hangs Chris Wilson 2018-02-07 9:50 ` [PATCH igt] igt/gem_eio: Exercise set-wedging against request submission Chris Wilson 2018-02-20 22:31 ` Antonio Argenziano 2018-02-20 22:45 ` Chris Wilson
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=20180317090901.2656-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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.