intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t 1/2] i915/gem_mmap_offset: Exercise many, many mmap_offset
@ 2020-01-17 22:22 Chris Wilson
  2020-01-17 22:22 ` [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_mmap_offset: Relax isolation rules Chris Wilson
  2020-01-17 23:16 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/2] i915/gem_mmap_offset: Exercise many, many mmap_offset Patchwork
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2020-01-17 22:22 UTC (permalink / raw)
  To: intel-gfx

Just keep on generating a new mmap_offset for the same old buffer, but
for different handles and so exercise the scaling of the obj->mmo lists.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
---
 tests/i915/gem_mmap_offset.c | 64 ++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
index 95e1e3e6c..c3b85d29e 100644
--- a/tests/i915/gem_mmap_offset.c
+++ b/tests/i915/gem_mmap_offset.c
@@ -326,6 +326,67 @@ static void close_race(int i915, int timeout)
 	munmap(handles, len);
 }
 
+static void open_flood(int i915, int timeout)
+{
+	unsigned long count;
+	uint32_t handle;
+	int dmabuf;
+	int *ctl;
+
+	ctl = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	igt_assert(ctl != MAP_FAILED);
+
+	handle = gem_create(i915, 4096);
+	dmabuf = prime_handle_to_fd(i915, handle);
+
+	for_each_mmap_offset_type(t) {
+		struct drm_i915_gem_mmap_offset arg = {
+			.handle = handle,
+			.flags = t->type,
+		};
+
+		if (mmap_offset_ioctl(i915, &arg))
+			continue;
+
+		igt_fork(child, 1) {
+			i915 = gem_reopen_driver(i915);
+			arg.handle = prime_fd_to_handle(i915, dmabuf);
+
+			do {
+				igt_assert_eq(mmap_offset_ioctl(i915, &arg), 0);
+			} while (!READ_ONCE(*ctl));
+		}
+	}
+	gem_close(i915, handle);
+
+	count = 0;
+	igt_until_timeout(timeout) {
+		int tmp;
+
+		tmp = gem_reopen_driver(i915);
+		handle = prime_fd_to_handle(i915, dmabuf);
+
+		for_each_mmap_offset_type(t) {
+			struct drm_i915_gem_mmap_offset arg = {
+				.handle = handle,
+				.flags = t->type,
+			};
+
+			mmap_offset_ioctl(i915, &arg);
+		}
+
+		close(tmp);
+		count++;
+	}
+
+	igt_info("Completed %lu cycles\n", count);
+	close(dmabuf);
+
+	*ctl = 1;
+	igt_waitchildren();
+	munmap(ctl, 4096);
+}
+
 static uint64_t atomic_compare_swap_u64(_Atomic(uint64_t) *ptr,
 					uint64_t oldval, uint64_t newval)
 {
@@ -488,6 +549,9 @@ igt_main
 	igt_subtest_f("close-race")
 		close_race(i915, 20);
 
+	igt_subtest_f("open-flood")
+		open_flood(i915, 20);
+
 	igt_subtest_f("clear")
 		always_clear(i915, 20);
 
-- 
2.25.0

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

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

end of thread, other threads:[~2020-01-17 23:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17 22:22 [Intel-gfx] [PATCH i-g-t 1/2] i915/gem_mmap_offset: Exercise many, many mmap_offset Chris Wilson
2020-01-17 22:22 ` [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_mmap_offset: Relax isolation rules Chris Wilson
2020-01-17 23:16 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/2] i915/gem_mmap_offset: Exercise many, many mmap_offset Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).