[igt-dev] [PATCH i-g-t] i915/perf_pmu: Cap target number of interrupts

Chris Wilson chris at chris-wilson.co.uk
Tue Dec 10 12:19:34 UTC 2019


Limit the maximum number of interrupts in order to avoid overburdening
older CPUs and GPUs.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/perf_pmu.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 33fb4d653..e1bbf2410 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -1274,11 +1274,15 @@ static void cpu_hotplug(int gem_fd)
 	assert_within_epsilon(val, ts[1] - ts[0], tolerance);
 }
 
+static int target_num_interrupts(int i915)
+{
+	return min(gem_measure_ring_inflight(i915, I915_EXEC_DEFAULT, 0), 30);
+}
+
 static void
 test_interrupts(int gem_fd)
 {
-	const int target =
-		gem_measure_ring_inflight(gem_fd, I915_EXEC_DEFAULT, 0);
+	const int target = target_num_interrupts(gem_fd);
 	const unsigned int test_duration_ms = 1000;
 	igt_spin_t *spin[target];
 	struct pollfd pfd;
@@ -1342,8 +1346,7 @@ test_interrupts(int gem_fd)
 static void
 test_interrupts_sync(int gem_fd)
 {
-	const int target =
-		gem_measure_ring_inflight(gem_fd, I915_EXEC_DEFAULT, 0);
+	const int target = target_num_interrupts(gem_fd);
 	const unsigned int test_duration_ms = 1000;
 	igt_spin_t *spin[target];
 	struct pollfd pfd;
-- 
2.24.0



More information about the igt-dev mailing list