summaryrefslogtreecommitdiff
path: root/tests/perf_pmu.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-05-25 16:10:51 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-05-30 08:42:48 +0100
commit6796a604bab6df9c84af149e799902360afdd157 (patch)
tree3da3b6c65c6e941ad914951378c882b0da456fc1 /tests/perf_pmu.c
parent43f7a746ac092e41d4745ed190d4268ef1f82c55 (diff)
igt/perf_pmu: Flush to idle after hang
We may not idle immediately after a hang, and indeed may send a pulse down the pipeline periodically to become idle. Rather than make a flimsy assumption about how long we need to sleep before the system idles, wait for the system to declare itself idle; flushing it to idle in the process! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
Diffstat (limited to 'tests/perf_pmu.c')
-rw-r--r--tests/perf_pmu.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 590e6526..9af192dd 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -281,16 +281,9 @@ single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
/* Check for idle after hang. */
if (flags & FLAG_HANG) {
- /* Sleep for a bit for reset unwind to settle. */
- usleep(500e3);
- /*
- * Ensure batch was executing before reset, meaning it must be
- * idle by now. Unless it did not even manage to start before we
- * triggered the reset, in which case the idleness check below
- * might fail. The latter is very unlikely since there are two
- * sleeps during which it had an opportunity to start.
- */
+ gem_quiescent_gpu(gem_fd);
igt_assert(!gem_bo_busy(gem_fd, spin->handle));
+
val = pmu_read_single(fd);
slept = measured_usleep(batch_duration_ns / 1000);
val = pmu_read_single(fd) - val;