[igt-dev] [PATCH i-g-t 1/6] test/perf: Drop caches when closing perf stream

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Tue Mar 3 22:38:08 UTC 2020


Running ./build/tests/perf will run all the perf subtests in a sequence.
When running tests in a sequence, subsequent tests may not run with a
clean slate. For resources that are lazily released, drop caches in
__perf_close.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
---
 tests/perf.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/perf.c b/tests/perf.c
index 5e818030..189c6aa1 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -244,6 +244,12 @@ __perf_close(int fd)
 		close(pm_fd);
 		pm_fd = -1;
 	}
+
+	/* When running tests in a sequence, subsequent tests may not run with a
+	 * clean slate. For resources that are lazily released, cleanup here.
+	 */
+	if (drm_fd >= 0 && !getgid() && !getuid())
+		gem_quiescent_gpu(drm_fd);
 }
 
 static int
@@ -3993,7 +3999,6 @@ test_rc6_disable(void)
 	igt_assert_eq(n_events_end - n_events_start, 0);
 
 	__perf_close(stream_fd);
-	gem_quiescent_gpu(drm_fd);
 
 	n_events_start = rc6_residency_ms();
 	nanosleep(&(struct timespec){ .tv_sec = 1, .tv_nsec = 0 }, NULL);
-- 
2.20.1



More information about the igt-dev mailing list