[Intel-gfx] [PATCH 2/2] tests: add reloc, pread, pwrite slow path subtest

Xiong Zhang xiong.y.zhang at intel.com
Fri Jul 19 12:42:52 CEST 2013


the reloc, pread, pwrite slow path will be prevented by prefault,
these subtests will disable prefault first, then do reloc, pread,
pwrite, finally enable prefault.

Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>
---
 tests/gem_exec_faulting_reloc.c | 10 +++++++++-
 tests/gem_mmap_gtt.c            | 15 +++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/tests/gem_exec_faulting_reloc.c b/tests/gem_exec_faulting_reloc.c
index 863a1b0..c7f7b6b 100644
--- a/tests/gem_exec_faulting_reloc.c
+++ b/tests/gem_exec_faulting_reloc.c
@@ -220,7 +220,15 @@ static void run(int object_size)
 
 int main(int argc, char **argv)
 {
-	run(OBJECT_SIZE);
+	drmtest_subtest_init(argc, argv);
+
+	if (drmtest_run_subtest("normal"))
+		run(OBJECT_SIZE);
+	if (drmtest_run_subtest("no-prefault")) {
+		drmtest_disable_prefault();
+		run(OBJECT_SIZE);
+		drmtest_enable_prefault();
+	}
 
 	return 0;
 }
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index d759340..0e1b195 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -144,6 +144,15 @@ test_read(int fd)
 	munmap(dst, OBJECT_SIZE);
 }
 
+static void
+run_without_prefault(int fd,
+			void (*func)(int fd))
+{
+	drmtest_disable_prefault();
+	func(fd);
+	drmtest_enable_prefault();
+}
+
 int main(int argc, char **argv)
 {
 	int fd;
@@ -160,6 +169,12 @@ int main(int argc, char **argv)
 		test_write(fd);
 	if (drmtest_run_subtest("write-gtt"))
 		test_write_gtt(fd);
+	if (drmtest_run_subtest("read-no-prefault"))
+		run_without_prefault(fd, test_read);
+	if (drmtest_run_subtest("write-no-prefault"))
+		run_without_prefault(fd, test_write);
+	if (drmtest_run_subtest("write-gtt-no-prefault"))
+		run_without_prefault(fd, test_write_gtt);
 
 	close(fd);
 
-- 
1.8.3.2




More information about the Intel-gfx mailing list