[igt-dev] [PATCH i-g-t] tests/gem_softpin: Check using same offset in more children

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Mar 31 11:33:25 UTC 2021


Check vma eviction for same offset is working properly when
execbuf stresstest is executed.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_softpin.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/i915/gem_softpin.c b/tests/i915/gem_softpin.c
index aba060a42..0723e6a5c 100644
--- a/tests/i915/gem_softpin.c
+++ b/tests/i915/gem_softpin.c
@@ -247,6 +247,29 @@ static void test_full(int i915)
 	gem_close(i915, obj[0].handle);
 }
 
+static void test_fork(int fd)
+{
+	struct drm_i915_gem_execbuffer2 execbuf;
+	struct drm_i915_gem_exec_object2 obj = {0};
+	uint32_t batch = MI_BATCH_BUFFER_END;
+
+	igt_fork(child, 2) {
+		igt_until_timeout(5) {
+			memset(&execbuf, 0, sizeof(execbuf));
+			obj.handle = gem_create(fd, 4096);
+			obj.offset = 0x1000;
+			obj.flags = EXEC_OBJECT_PINNED;
+			execbuf.buffers_ptr = to_user_pointer(&obj);
+			execbuf.buffer_count = 1;
+			gem_write(fd, obj.handle, 0, &batch, sizeof(batch));
+			gem_execbuf(fd, &execbuf);
+			gem_close(fd, obj.handle);
+		}
+	}
+
+	igt_waitchildren();
+}
+
 static void test_softpin(int fd)
 {
 	const uint32_t size = 1024 * 1024;
@@ -727,6 +750,9 @@ igt_main
 
 		igt_subtest("full")
 			test_full(fd);
+
+		igt_subtest("fork")
+			test_fork(fd);
 	}
 
 	igt_subtest("softpin")
-- 
2.26.0



More information about the igt-dev mailing list