[i-g-t] i915/perf_pmu: Cap target number of interrupts
diff mbox series

Message ID 20191210121934.3845438-1-chris@chris-wilson.co.uk
State New
Headers show
Series
  • [i-g-t] i915/perf_pmu: Cap target number of interrupts
Related show

Commit Message

Chris Wilson Dec. 10, 2019, 12:19 p.m. UTC
Limit the maximum number of interrupts in order to avoid overburdening
older CPUs and GPUs.

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

Patch
diff mbox series

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;