Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/2] tests/perf_pmu: Verify busyness when PMU is enabled after engine got busy
@ 2018-01-09 16:16 Tvrtko Ursulin
  2018-01-09 16:16 ` [PATCH i-g-t 2/2] tests/perf_pmu: Exercise busy stats and lite-restore Tvrtko Ursulin
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Tvrtko Ursulin @ 2018-01-09 16:16 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Make sure busyness is correctly reported when PMU is enabled after the
engine is already busy with a single long batch.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tests/perf_pmu.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 45e2f6148453..e1f449d48808 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -157,6 +157,41 @@ single(int gem_fd, const struct intel_execution_engine2 *e, bool busy)
 	gem_quiescent_gpu(gem_fd);
 }
 
+static void
+busy_start(int gem_fd, const struct intel_execution_engine2 *e)
+{
+	unsigned long slept;
+	igt_spin_t *spin;
+	uint64_t val;
+	int fd;
+
+	/*
+	 * Defeat the busy stats delayed disable, we need to guarantee we are
+	 * the first user.
+	 */
+	if (gem_has_execlists(gem_fd))
+		sleep(2);
+
+	spin = __igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
+
+	/*
+	 * Sleep for a bit after making the engine busy to make sure the PMU
+	 * gets enabled when the batch is already running.
+	 */
+	usleep(500000);
+
+	fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance));
+
+	slept = measured_usleep(batch_duration_ns / 1000);
+	val = pmu_read_single(fd);
+
+	igt_spin_batch_free(gem_fd, spin);
+	close(fd);
+
+	assert_within_epsilon(val, slept, tolerance);
+	gem_quiescent_gpu(gem_fd);
+}
+
 static void log_busy(int fd, unsigned int num_engines, uint64_t *val)
 {
 	char buf[1024];
@@ -1164,6 +1199,13 @@ igt_main
 		 */
 		igt_subtest_f("multi-client-%s", e->name)
 			multi_client(fd, e);
+
+		/**
+		 * Check that reported usage is correct when PMU is enabled
+		 * after the batch is running.
+		 */
+		igt_subtest_f("busy-start-%s", e->name)
+			busy_start(fd, e);
 	}
 
 	/**
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-01-11 13:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-09 16:16 [PATCH i-g-t 1/2] tests/perf_pmu: Verify busyness when PMU is enabled after engine got busy Tvrtko Ursulin
2018-01-09 16:16 ` [PATCH i-g-t 2/2] tests/perf_pmu: Exercise busy stats and lite-restore Tvrtko Ursulin
2018-01-09 21:39   ` Chris Wilson
2018-01-10 10:37     ` Tvrtko Ursulin
2018-01-10 13:45       ` Chris Wilson
2018-01-11  8:46         ` [PATCH i-g-t v2 " Tvrtko Ursulin
2018-01-09 16:59 ` ✓ Fi.CI.BAT: success for series starting with [1/2] tests/perf_pmu: Verify busyness when PMU is enabled after engine got busy Patchwork
2018-01-09 18:57 ` ✗ Fi.CI.IGT: warning " Patchwork
2018-01-09 21:28 ` [PATCH i-g-t 1/2] " Chris Wilson
2018-01-10 10:42   ` Tvrtko Ursulin
2018-01-10 13:38     ` Chris Wilson
2018-01-11  8:46       ` [PATCH i-g-t v2 " Tvrtko Ursulin
2018-01-11 13:21 ` ✗ Fi.CI.BAT: failure for series starting with [v2,1/2] tests/perf_pmu: Verify busyness when PMU is enabled after engine got busy (rev3) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox