Skip to contentSkip to conversation

tests/gem_spin_batch: Add multiengine test

PATCH In review Mika Kuoppala 2 participants 3 messages Apr 13, 2017 – Apr 19, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/gem_spin_batch: Add multiengine test

Parallel spin on all engines.

---
 tests/gem_spin_batch.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
tests/gem_spin_batch.c +29 -2
index baf796a..a22da32 100644
@@ -32,7 +32,7 @@
 		     "'%s' != '%s' (%lld not within %d%% tolerance of %lld)\n",\
 		     #x, #ref, (long long)x, tolerance, (long long)ref)
 
-static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
+static void spin(int fd, unsigned int engine, unsigned int timeout_sec)
 {
 	const uint64_t timeout_100ms = 100000000LL;
 	unsigned long loops = 0;
@@ -63,6 +63,30 @@ static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
 }
 
+static void spin_exit_handler(int sig)
+{
+	igt_fixture {
+		igt_terminate_spin_batches();
+	}
+}
+
+static void spin_on_all_engines(int fd, unsigned int timeout_sec)
+{
+	unsigned engine;
+
+	for_each_engine(fd, engine) {
+		if (engine == 0)
+			continue;
+
+		igt_fork(child, 1) {
+			igt_install_exit_handler(spin_exit_handler);
+			spin(fd, engine, timeout_sec);
+		}
+	}
+
+	igt_waitchildren();
+}
+
 igt_main
 {
 	const struct intel_execution_engine *e;
@@ -82,9 +106,12 @@ igt_main
 			continue;
 
 		igt_subtest_f("basic-%s", e->name)
-			basic(fd, e->exec_id, 3);
+			spin(fd, e->exec_id, 3);
 	}
 
+	igt_subtest("multiengine")
+		spin_on_all_engines(fd, 3);
+
 	igt_fixture {
 		igt_stop_hang_detector();
 		close(fd);
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Mika Kuoppala

Parallel spin on all engines.

---
 tests/gem_spin_batch.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
tests/gem_spin_batch.c +1 -1
index baf796a..a22da32 100644
@@ -32,7 +32,7 @@
 		     "'%s' != '%s' (%lld not within %d%% tolerance of %lld)\n",\
 		     #x, #ref, (long long)x, tolerance, (long long)ref)
 
-static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
+static void spin(int fd, unsigned int engine, unsigned int timeout_sec)
 {
 	const uint64_t timeout_100ms = 100000000LL;
 	unsigned long loops = 0;

tests/gem_spin_batch.c static void basic(int fd, unsigned int engine, unsigned int timeout_sec) · line 68

Quoted 6 lines
tests/gem_spin_batch.c +3 -0
@@ -63,6 +63,30 @@ static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
 }
 
+static void spin_exit_handler(int sig)
+{
+	igt_fixture {

Should not be required?

Quoted 4 lines
tests/gem_spin_batch.c +4 -0
+		igt_terminate_spin_batches();
+	}
+}
+

tests/gem_spin_batch.c static void basic(int fd, unsigned int engine, unsigned int timeout_sec) · line 82

Quoted 10 lines
tests/gem_spin_batch.c +10 -0
+static void spin_on_all_engines(int fd, unsigned int timeout_sec)
+{
+	unsigned engine;
+
+	for_each_engine(fd, engine) {
+		if (engine == 0)
+			continue;
+
+		igt_fork(child, 1) {
+			igt_install_exit_handler(spin_exit_handler);

Ok. The existing igt_terminate_spin_batches() is tied into the exit handler of the parent process (from quiescent_gpu_at_exit).

Quoted 11 lines
tests/gem_spin_batch.c +7 -0
+			spin(fd, engine, timeout_sec);
+		}
+	}
+
+	igt_waitchildren();
+}
+
 igt_main
 {
 	const struct intel_execution_engine *e;

tests/gem_spin_batch.c igt_main · line 112

Quoted 8 lines
tests/gem_spin_batch.c +2 -1
@@ -82,9 +106,12 @@ igt_main
 			continue;
 
 		igt_subtest_f("basic-%s", e->name)
-			basic(fd, e->exec_id, 3);
+			spin(fd, e->exec_id, 3);
 	}
 
+	igt_subtest("multiengine")

I would call this spin-each, to try and differentiate this spin on each engine independently from a second variant that shared a single batch between all engines (spin-all).

That make take some tweaks to igt_spin_batch (hmm, actually should not be that difficult...) and might be worth doing just in case there's a diffference in TLB behaviour or whatnot.

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 73 lines · Chris Wilson
Quoted 21 lines · Mika Kuoppala

Parallel spin on all engines.

---
 tests/gem_spin_batch.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
tests/gem_spin_batch.c +1 -1
index baf796a..a22da32 100644
@@ -32,7 +32,7 @@
 		     "'%s' != '%s' (%lld not within %d%% tolerance of %lld)\n",\
 		     #x, #ref, (long long)x, tolerance, (long long)ref)
 
-static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
+static void spin(int fd, unsigned int engine, unsigned int timeout_sec)
 {
 	const uint64_t timeout_100ms = 100000000LL;
 	unsigned long loops = 0;

tests/gem_spin_batch.c static void basic(int fd, unsigned int engine, unsigned int timeout_sec) · line 68

Quoted 6 lines
tests/gem_spin_batch.c +3 -0
@@ -63,6 +63,30 @@ static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
 }
 
+static void spin_exit_handler(int sig)
+{
+	igt_fixture {

Should not be required?

Quoted 4 lines
tests/gem_spin_batch.c +4 -0
+		igt_terminate_spin_batches();
+	}
+}
+

tests/gem_spin_batch.c static void basic(int fd, unsigned int engine, unsigned int timeout_sec) · line 82

Quoted 10 lines
tests/gem_spin_batch.c +10 -0
+static void spin_on_all_engines(int fd, unsigned int timeout_sec)
+{
+	unsigned engine;
+
+	for_each_engine(fd, engine) {
+		if (engine == 0)
+			continue;
+
+		igt_fork(child, 1) {
+			igt_install_exit_handler(spin_exit_handler);

Ok. The existing igt_terminate_spin_batches() is tied into the exit handler of the parent process (from quiescent_gpu_at_exit).

Quoted 11 lines
tests/gem_spin_batch.c +7 -0
+			spin(fd, engine, timeout_sec);
+		}
+	}
+
+	igt_waitchildren();
+}
+
 igt_main
 {
 	const struct intel_execution_engine *e;

tests/gem_spin_batch.c igt_main · line 112

Quoted 8 lines
tests/gem_spin_batch.c +2 -1
@@ -82,9 +106,12 @@ igt_main
 			continue;
 
 		igt_subtest_f("basic-%s", e->name)
-			basic(fd, e->exec_id, 3);
+			spin(fd, e->exec_id, 3);
 	}
 
+	igt_subtest("multiengine")

I would call this spin-each, to try and differentiate this spin on each engine independently from a second variant that shared a single batch between all engines (spin-all).

Quoted 4 lines

That make take some tweaks to igt_spin_batch (hmm, actually should not be that difficult...) and might be worth doing just in case there's a diffference in TLB behaviour or whatnot.

Renamed the test and removed the fixture.

Quoted 1 line

Thanks. Pushed.
-Mika
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx