All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/3] i915/gem_eio: Race kms on/off vs reset
@ 2019-09-11 10:14 ` Chris Wilson
  0 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-09-11 10:14 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

On older platforms, performing a GPU reset clobbers the display.
Exercise the interactions between reset/wedge and the display and
hopefully prevent any races creeping in.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/i915/gem_eio.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/tests/i915/gem_eio.c b/tests/i915/gem_eio.c
index 9b086a039..e0213c76c 100644
--- a/tests/i915/gem_eio.c
+++ b/tests/i915/gem_eio.c
@@ -42,6 +42,8 @@
 
 #include "igt.h"
 #include "igt_device.h"
+#include "igt_fb.h"
+#include "igt_kms.h"
 #include "igt_stats.h"
 #include "igt_sysfs.h"
 #include "sw_sync.h"
@@ -813,6 +815,67 @@ static void test_reset_stress(int fd, unsigned int flags)
 	gem_context_destroy(fd, ctx0);
 }
 
+/*
+ * Modesetting vs wedged
+ */
+
+static void display_helper(igt_display_t *dpy, int *done)
+{
+	const int commit = dpy->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY;
+	struct igt_fb fb = {};
+
+	while (!READ_ONCE(*done)) {
+		drmModeModeInfoPtr mode;
+		igt_plane_t *primary;
+		igt_output_t *output;
+		int pipe;
+
+		pipe = rand() % dpy->n_pipes;
+		output = igt_get_single_output_for_pipe(dpy, pipe);
+		if (!output)
+			continue;
+
+		igt_output_set_pipe(output, pipe);
+		mode = igt_output_get_mode(output);
+
+		if (fb.width != mode->hdisplay || fb.height != mode->vdisplay) {
+			igt_remove_fb(dpy->drm_fd, &fb);
+			igt_create_pattern_fb(dpy->drm_fd,
+					      mode->hdisplay, mode->vdisplay,
+					      DRM_FORMAT_XRGB8888,
+					      LOCAL_I915_FORMAT_MOD_X_TILED,
+					      &fb);
+		}
+
+		primary = igt_output_get_plane_type(output,
+						    DRM_PLANE_TYPE_PRIMARY);
+		igt_plane_set_fb(primary, &fb);
+
+		igt_display_commit2(dpy, commit);
+		igt_display_reset(dpy);
+	}
+
+	igt_remove_fb(dpy->drm_fd, &fb);
+}
+
+static void test_kms(int i915, igt_display_t *dpy)
+{
+	int *shared;
+
+	shared = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	igt_assert(shared != MAP_FAILED);
+
+	igt_fork(child, 1)
+		display_helper(dpy, shared);
+
+	test_reset_stress(i915, 0);
+	test_reset_stress(i915, TEST_WEDGE);
+
+	*shared = 1;
+	igt_waitchildren();
+	munmap(shared, 4096);
+}
+
 static int fd = -1;
 
 static void
@@ -906,4 +969,20 @@ igt_main
 			}
 		}
 	}
+
+	igt_subtest_group {
+		igt_display_t display = {
+			.drm_fd = -1, .n_pipes = IGT_MAX_PIPES
+		};
+
+		igt_fixture {
+			igt_device_set_master(fd);
+
+			igt_display_require(&display, fd);
+			igt_display_require_output(&display);
+		}
+
+		igt_subtest("kms")
+			test_kms(fd, &display);
+	}
 }
-- 
2.23.0

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

^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [igt-dev] [PATCH i-g-t 1/3] i915/gem_exec_schedule: Check timeslice
@ 2019-08-08 22:32 Chris Wilson
  2019-08-08 22:32 ` [igt-dev] [PATCH i-g-t 2/3] Force spin-batch to cause a hang as required Chris Wilson
  0 siblings, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2019-08-08 22:32 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Tvrtko Ursulin

Check that we can run a second request even if an equal priority spinner
is hogging the engine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tests/i915/gem_exec_schedule.c | 36 ++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index 6e8466299..e57c67170 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -1028,6 +1028,39 @@ static void preempt_queue(int fd, unsigned ring, unsigned int flags)
 	}
 }
 
+static void preempt_timeslice(int fd, unsigned ring)
+{
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
+	struct drm_i915_gem_exec_object2 obj = {
+		.handle = gem_create(fd, 4096)
+	};
+	struct drm_i915_gem_execbuffer2 execbuf = {
+		.buffers_ptr = to_user_pointer(&obj),
+		.buffer_count = 1,
+		.flags = ring,
+		.rsvd1 = gem_context_create(fd),
+	};
+	igt_spin_t *spin;
+
+	/*
+	 * Launch a spinner to occupy the target engine, and then
+	 * check we execute a ping underneath it from a second context.
+	 */
+	spin = igt_spin_new(fd, .engine = ring, .flags = IGT_SPIN_POLL_RUN);
+	igt_spin_busywait_until_started(spin);
+
+	/* Both the active spinner and this are at the same priority */
+	gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
+	gem_execbuf(fd, &execbuf);
+	gem_sync(fd, obj.handle);
+
+	igt_assert(gem_bo_busy(fd, spin->handle));
+	igt_spin_free(fd, spin);
+
+	gem_context_destroy(fd, execbuf.rsvd1);
+	gem_close(fd, obj.handle);
+}
+
 static void preempt_self(int fd, unsigned ring)
 {
 	uint32_t result = gem_create(fd, 4096);
@@ -1735,6 +1768,9 @@ igt_main
 					igt_subtest_f("preempt-queue-contexts-chain-%s", e->name)
 						preempt_queue(fd, e->exec_id | e->flags, CONTEXTS | CHAIN);
 
+					igt_subtest_f("preempt-timeslice-%s", e->name)
+						preempt_timeslice(fd, e->exec_id | e->flags);
+
 					igt_subtest_group {
 						igt_hang_t hang;
 
-- 
2.23.0.rc1

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

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

end of thread, other threads:[~2019-09-19 14:28 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-11 10:14 [igt-dev] [PATCH i-g-t 1/3] i915/gem_eio: Race kms on/off vs reset Chris Wilson
2019-09-11 10:14 ` Chris Wilson
2019-09-11 10:15 ` [igt-dev] [PATCH i-g-t 2/3] Force spin-batch to cause a hang as required Chris Wilson
2019-09-11 10:15   ` Chris Wilson
2019-09-19 14:09   ` [igt-dev] " Andi Shyti
2019-09-19 14:09     ` Andi Shyti
2019-09-11 10:15 ` [igt-dev] [PATCH i-g-t 3/3] kms_busy: Replace fiddling with hangcheck modparam with explicit fence Chris Wilson
2019-09-11 10:15   ` Chris Wilson
2019-09-19 14:09   ` [igt-dev] " Andi Shyti
2019-09-19 14:09     ` Andi Shyti
2019-09-11 10:54 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] i915/gem_eio: Race kms on/off vs reset Patchwork
2019-09-11 17:12 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-09-19 14:08 ` [igt-dev] [PATCH i-g-t 1/3] " Andi Shyti
2019-09-19 14:08   ` Andi Shyti
2019-09-19 14:20   ` Chris Wilson
2019-09-19 14:20     ` Chris Wilson
2019-09-19 14:28 ` Ville Syrjälä
2019-09-19 14:28   ` Ville Syrjälä
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08 22:32 [igt-dev] [PATCH i-g-t 1/3] i915/gem_exec_schedule: Check timeslice Chris Wilson
2019-08-08 22:32 ` [igt-dev] [PATCH i-g-t 2/3] Force spin-batch to cause a hang as required Chris Wilson

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.