All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] igt/gem_eio: Exercise set-wedging against request submission
@ 2018-06-18  9:53 ` Chris Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2018-06-18  9:53 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.

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 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)

diff --git a/tests/gem_eio.c b/tests/gem_eio.c
index 5faf7502b..f0dda8150 100644
--- a/tests/gem_eio.c
+++ b/tests/gem_eio.c
@@ -34,6 +34,8 @@
 #include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
+#include <sched.h>
+#include <signal.h>
 #include <sys/ioctl.h>
 #include <signal.h>
 #include <time.h>
@@ -43,6 +45,7 @@
 #include "igt.h"
 #include "igt_device.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).");
@@ -705,6 +708,111 @@ static void test_reset_stress(int fd, unsigned int flags)
 	gem_context_destroy(fd, ctx0);
 }
 
+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;
+
+	igt_require_sw_sync();
+	igt_require(gem_has_contexts(fd));
+
+	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
@@ -795,4 +903,7 @@ igt_main
 			}
 		}
 	}
+
+	igt_subtest("set-wedged-racing")
+		test_set_wedged(fd);
 }
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [igt-dev] [PATCH i-g-t] igt/gem_eio: Exercise set-wedging against request submission
@ 2018-06-18  9:53 ` Chris Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2018-06-18  9:53 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Mika Kuoppala

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 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)

diff --git a/tests/gem_eio.c b/tests/gem_eio.c
index 5faf7502b..f0dda8150 100644
--- a/tests/gem_eio.c
+++ b/tests/gem_eio.c
@@ -34,6 +34,8 @@
 #include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
+#include <sched.h>
+#include <signal.h>
 #include <sys/ioctl.h>
 #include <signal.h>
 #include <time.h>
@@ -43,6 +45,7 @@
 #include "igt.h"
 #include "igt_device.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).");
@@ -705,6 +708,111 @@ static void test_reset_stress(int fd, unsigned int flags)
 	gem_context_destroy(fd, ctx0);
 }
 
+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;
+
+	igt_require_sw_sync();
+	igt_require(gem_has_contexts(fd));
+
+	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
@@ -795,4 +903,7 @@ igt_main
 			}
 		}
 	}
+
+	igt_subtest("set-wedged-racing")
+		test_set_wedged(fd);
 }
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for igt/gem_eio: Exercise set-wedging against request submission (rev3)
  2018-06-18  9:53 ` [igt-dev] " Chris Wilson
  (?)
@ 2018-06-18 10:19 ` Patchwork
  -1 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2018-06-18 10:19 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: igt/gem_eio: Exercise set-wedging against request submission (rev3)
URL   : https://patchwork.freedesktop.org/series/39598/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4332 -> IGTPW_1475 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/39598/revisions/3/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1475 that come from known issues:

  === IGT changes ===

    ==== Possible fixes ====

    igt@kms_chamelium@dp-edid-read:
      fi-kbl-7500u:       FAIL (fdo#103841) -> PASS

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-glk-j4005:       FAIL (fdo#100368) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       DMESG-FAIL (fdo#102614, fdo#106103) -> PASS

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
  fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
  fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103


== Participating hosts (40 -> 36) ==

  Additional (1): fi-bwr-2160 
  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * IGT: IGT_4522 -> IGTPW_1475

  CI_DRM_4332: 35d2e46192bf51f81d3d474b13cca1a607610843 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1475: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1475/
  IGT_4522: 077c6f7c3786334c5e5c34888ab446fdb4347331 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@gem_eio@set-wedged-racing

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1475/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for igt/gem_eio: Exercise set-wedging against request submission (rev3)
  2018-06-18  9:53 ` [igt-dev] " Chris Wilson
  (?)
  (?)
@ 2018-06-18 11:59 ` Patchwork
  -1 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2018-06-18 11:59 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: igt/gem_eio: Exercise set-wedging against request submission (rev3)
URL   : https://patchwork.freedesktop.org/series/39598/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4522_full -> IGTPW_1475_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1475_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1475_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/39598/revisions/3/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1475_full:

  === IGT changes ===

    ==== Possible regressions ====

    {igt@gem_eio@set-wedged-racing}:
      shard-kbl:          NOTRUN -> FAIL
      shard-apl:          NOTRUN -> FAIL

    
    ==== Warnings ====

    igt@gem_exec_schedule@deep-vebox:
      shard-kbl:          SKIP -> PASS +3

    igt@gem_tiled_blits@interruptible:
      shard-apl:          SKIP -> PASS

    igt@kms_atomic@plane_invalid_params_fence:
      shard-snb:          SKIP -> PASS

    
== Known issues ==

  Here are the changes found in IGTPW_1475_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    {igt@gem_eio@set-wedged-racing}:
      shard-hsw:          NOTRUN -> INCOMPLETE (fdo#103540)
      shard-snb:          NOTRUN -> INCOMPLETE (fdo#105411)

    igt@gem_exec_schedule@pi-ringfull-bsd2:
      shard-kbl:          NOTRUN -> FAIL (fdo#103158)

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-glk:          NOTRUN -> FAIL (fdo#106641)
      shard-kbl:          NOTRUN -> FAIL (fdo#106641)

    igt@kms_cursor_legacy@cursora-vs-flipa-toggle:
      shard-glk:          PASS -> DMESG-WARN (fdo#105763)

    igt@kms_flip@2x-plain-flip-ts-check-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368)

    igt@kms_rotation_crc@sprite-rotation-180:
      shard-snb:          PASS -> FAIL (fdo#104724, fdo#103925)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_gtt:
      shard-apl:          FAIL (fdo#105347) -> PASS

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS +2

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-glk:          FAIL (fdo#102887, fdo#105363) -> PASS

    igt@kms_flip@modeset-vs-vblank-race:
      shard-hsw:          FAIL (fdo#103060) -> PASS

    igt@kms_setmode@basic:
      shard-kbl:          FAIL (fdo#99912) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
  fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
  fdo#103158 https://bugs.freedesktop.org/show_bug.cgi?id=103158
  fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
  fdo#105347 https://bugs.freedesktop.org/show_bug.cgi?id=105347
  fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4522 -> IGTPW_1475
    * Linux: CI_DRM_4329 -> CI_DRM_4332

  CI_DRM_4329: 02d8db1a894b0e646b2debd64ce24b8e99fd2ffd @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4332: 35d2e46192bf51f81d3d474b13cca1a607610843 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1475: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1475/
  IGT_4522: 077c6f7c3786334c5e5c34888ab446fdb4347331 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1475/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-18 11:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18  9:53 [PATCH i-g-t] igt/gem_eio: Exercise set-wedging against request submission Chris Wilson
2018-06-18  9:53 ` [igt-dev] " Chris Wilson
2018-06-18 10:19 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/gem_eio: Exercise set-wedging against request submission (rev3) Patchwork
2018-06-18 11:59 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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.