Skip to contentSkip to conversation

tests/gem_fence_trash: make threaded tests more through-rough

PATCH In review Daniel Vetter 2 participants 5 messages Apr 7, 2013 – Apr 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/gem_fence_trash: make threaded tests more through-rough

With this at least the y-tiled test reliably fails on my machines, but x-tiled still passes on some. More ideas to tune this highly welcome.

---
 tests/gem_fence_thrash.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
tests/gem_fence_thrash.c +10 -2
index 3fc72a1..2bd5f83 100644
@@ -216,11 +216,19 @@ main(int argc, char **argv)
 	if (drmtest_run_subtest("bo-write-verify-threaded-none"))
 		assert (run_test(5, bo_write_verify, I915_TILING_NONE, 2) == 0);
 
-	if (drmtest_run_subtest("bo-write-verify-threaded-x"))
+	if (drmtest_run_subtest("bo-write-verify-threaded-x")) {
+		assert (run_test(2, bo_write_verify, I915_TILING_X, 2) == 0);
 		assert (run_test(5, bo_write_verify, I915_TILING_X, 2) == 0);
+		assert (run_test(10, bo_write_verify, I915_TILING_X, 2) == 0);
+		assert (run_test(20, bo_write_verify, I915_TILING_X, 2) == 0);
+	}
 
-	if (drmtest_run_subtest("bo-write-verify-threaded-y"))
+	if (drmtest_run_subtest("bo-write-verify-threaded-y")) {
+		assert (run_test(2, bo_write_verify, I915_TILING_Y, 2) == 0);
 		assert (run_test(5, bo_write_verify, I915_TILING_Y, 2) == 0);
+		assert (run_test(10, bo_write_verify, I915_TILING_Y, 2) == 0);
+		assert (run_test(20, bo_write_verify, I915_TILING_Y, 2) == 0);
+	}
 
 	if (drmtest_run_subtest("bo-copy"))
 		assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 4 lines · Daniel Vetter

With this at least the y-tiled test reliably fails on my machines, but x-tiled still passes on some. More ideas to tune this highly welcome.

Correction: Y-tiled still seems to not fail on my snb mobile gt2. I don't have a desktop snb to test, so can't tell. And the only machine which fails the x-tiled test is a deskopt ivb.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#2 lore raw

PATCH 1/1 tests/kms_flip: don't leak gpu hang state

We need to clear out the error_state. While at it also make sure that the hang was indeed detected.

Whoever writes the next test to race against gpu hangs should probably extract these two functions into the drmtest library. Which just one user that's not really worth it right now.

v2: Fill cpu caches with data for each newly allocated bo. This seems to do the trick on my snb here _really_ reliably. So apparently the backsnoop for llc gtt writes is the crucial ingredient here to make the test fail.

While at it, also stop leaking mmap space.

Cc Mika Kuoppala <[email protected]>
Cc Chris Wilson <[email protected]>
---
 tests/gem_fence_thrash.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
tests/gem_fence_thrash.c +20 -3
index 3fc72a1..01fd0f6 100644
@@ -69,6 +69,12 @@ bo_create (int fd, int tiling)
 
 	handle = gem_create(fd, OBJECT_SIZE);
 
+	/* dirty cpu caches a bit ... */
+	ptr = gem_mmap__cpu(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	assert(ptr);
+	memset(ptr, 0, OBJECT_SIZE);
+	munmap(ptr, OBJECT_SIZE);
+
 	gem_set_tiling(fd, handle, tiling, 1024);
 
 	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
@@ -104,7 +110,7 @@ _bo_write_verify(struct test *t)
 {
 	int fd = t->fd;
 	int i, k;
-	volatile uint32_t **s;
+	uint32_t **s;
 	uint32_t v;
 	unsigned int dwords = OBJECT_SIZE >> 2;
 	const char *tile_str[] = { "none", "x", "y" };
@@ -141,6 +147,9 @@ _bo_write_verify(struct test *t)
 		}
 	}
 
+	for (k = 0; k < t->num_surfaces; k++)
+		munmap(s[k], OBJECT_SIZE);
+
 	free(s);
 }
 
@@ -216,11 +225,19 @@ main(int argc, char **argv)
 	if (drmtest_run_subtest("bo-write-verify-threaded-none"))
 		assert (run_test(5, bo_write_verify, I915_TILING_NONE, 2) == 0);
 
-	if (drmtest_run_subtest("bo-write-verify-threaded-x"))
+	if (drmtest_run_subtest("bo-write-verify-threaded-x")) {
+		assert (run_test(2, bo_write_verify, I915_TILING_X, 2) == 0);
 		assert (run_test(5, bo_write_verify, I915_TILING_X, 2) == 0);
+		assert (run_test(10, bo_write_verify, I915_TILING_X, 2) == 0);
+		assert (run_test(20, bo_write_verify, I915_TILING_X, 2) == 0);
+	}
 
-	if (drmtest_run_subtest("bo-write-verify-threaded-y"))
+	if (drmtest_run_subtest("bo-write-verify-threaded-y")) {
+		assert (run_test(2, bo_write_verify, I915_TILING_Y, 2) == 0);
 		assert (run_test(5, bo_write_verify, I915_TILING_Y, 2) == 0);
+		assert (run_test(10, bo_write_verify, I915_TILING_Y, 2) == 0);
+		assert (run_test(20, bo_write_verify, I915_TILING_Y, 2) == 0);
+	}
 
 	if (drmtest_run_subtest("bo-copy"))
 		assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
Signature · 1 line
1.7.11.7
#3 lore raw

PATCH 1/1 tests/gem_fence_trash: make threaded tests more through-rough

In reply to Daniel Vetter

With this at least the y-tiled test reliably fails on my machines, but x-tiled still passes on some. More ideas to tune this highly welcome.

v2: Fill cpu caches with data for each newly allocated bo. This seems to do the trick on my snb here _really_ reliably. So apparently the backsnoop for llc gtt writes is the crucial ingredient here to make the test fail.

While at it, also stop leaking mmap space.

v3: Fixup commit message.

Cc Mika Kuoppala <[email protected]>
Cc Chris Wilson <[email protected]>
---
 tests/gem_fence_thrash.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
tests/gem_fence_thrash.c +20 -3
index 3fc72a1..01fd0f6 100644
@@ -69,6 +69,12 @@ bo_create (int fd, int tiling)
 
 	handle = gem_create(fd, OBJECT_SIZE);
 
+	/* dirty cpu caches a bit ... */
+	ptr = gem_mmap__cpu(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	assert(ptr);
+	memset(ptr, 0, OBJECT_SIZE);
+	munmap(ptr, OBJECT_SIZE);
+
 	gem_set_tiling(fd, handle, tiling, 1024);
 
 	ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
@@ -104,7 +110,7 @@ _bo_write_verify(struct test *t)
 {
 	int fd = t->fd;
 	int i, k;
-	volatile uint32_t **s;
+	uint32_t **s;
 	uint32_t v;
 	unsigned int dwords = OBJECT_SIZE >> 2;
 	const char *tile_str[] = { "none", "x", "y" };
@@ -141,6 +147,9 @@ _bo_write_verify(struct test *t)
 		}
 	}
 
+	for (k = 0; k < t->num_surfaces; k++)
+		munmap(s[k], OBJECT_SIZE);
+
 	free(s);
 }
 
@@ -216,11 +225,19 @@ main(int argc, char **argv)
 	if (drmtest_run_subtest("bo-write-verify-threaded-none"))
 		assert (run_test(5, bo_write_verify, I915_TILING_NONE, 2) == 0);
 
-	if (drmtest_run_subtest("bo-write-verify-threaded-x"))
+	if (drmtest_run_subtest("bo-write-verify-threaded-x")) {
+		assert (run_test(2, bo_write_verify, I915_TILING_X, 2) == 0);
 		assert (run_test(5, bo_write_verify, I915_TILING_X, 2) == 0);
+		assert (run_test(10, bo_write_verify, I915_TILING_X, 2) == 0);
+		assert (run_test(20, bo_write_verify, I915_TILING_X, 2) == 0);
+	}
 
-	if (drmtest_run_subtest("bo-write-verify-threaded-y"))
+	if (drmtest_run_subtest("bo-write-verify-threaded-y")) {
+		assert (run_test(2, bo_write_verify, I915_TILING_Y, 2) == 0);
 		assert (run_test(5, bo_write_verify, I915_TILING_Y, 2) == 0);
+		assert (run_test(10, bo_write_verify, I915_TILING_Y, 2) == 0);
+		assert (run_test(20, bo_write_verify, I915_TILING_Y, 2) == 0);
+	}
 
 	if (drmtest_run_subtest("bo-copy"))
 		assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
Signature · 1 line
1.7.11.7
#4 lore raw
Quoted 8 lines · Daniel Vetter

With this at least the y-tiled test reliably fails on my machines, but x-tiled still passes on some. More ideas to tune this highly welcome.

v2: Fill cpu caches with data for each newly allocated bo. This seems to do the trick on my snb here _really_ reliably. So apparently the backsnoop for llc gtt writes is the crucial ingredient here to make the test fail.

Quoted 7 lines

While at it, also stop leaking mmap space.

v3: Fixup commit message.

Cc Mika Kuoppala <[email protected]>
Cc Chris Wilson <[email protected]>

Yes, that is much more effective - even at weeding out incomplete fixes which passed the original test case.

Quoted 9 lines
---
 tests/gem_fence_thrash.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
tests/gem_fence_thrash.c +0 -0
index 3fc72a1..01fd0f6 100644

tests/gem_fence_thrash.c bo_create (int fd, int tiling) · line 74

Quoted 6 lines
tests/gem_fence_thrash.c +3 -0
@@ -69,6 +69,12 @@ bo_create (int fd, int tiling)
 
 	handle = gem_create(fd, OBJECT_SIZE);
 
+	/* dirty cpu caches a bit ... */
+	ptr = gem_mmap__cpu(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+	assert(ptr);

Pedagogical:+ gem_set_domain(fd, handle,

                              I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre