From: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATCH i-g-t v2 5/9] tests/perf_pmu: Add trailing edge idle test variants
Date: Mon, 5 Feb 2018 11:36:12 +0000 [thread overview]
Message-ID: <20180205113612.14694-1-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <151760432399.15322.6945216875328756515@mail.alporthouse.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Additional set of tests which stops the batch and sleeps for a bit
before sampling the counter in order to test that the busyness stop
being recorded correctly.
v2: Reorganize end_spin and guards a bit. (Chris Wilson)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> # v1
---
tests/perf_pmu.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 67 insertions(+), 15 deletions(-)
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 3faa04a4f68a..5c7eb28a3920 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -131,6 +131,22 @@ static unsigned int e2ring(int gem_fd, const struct intel_execution_engine2 *e)
}
#define TEST_BUSY (1)
+#define FLAG_SYNC (2)
+#define TEST_TRAILING_IDLE (4)
+
+static void end_spin(int fd, igt_spin_t *spin, unsigned int flags)
+{
+ if (!spin)
+ return;
+
+ igt_spin_batch_end(spin);
+
+ if (flags & FLAG_SYNC)
+ gem_sync(fd, spin->handle);
+
+ if (flags & TEST_TRAILING_IDLE)
+ usleep(batch_duration_ns / 5000);
+}
static void
single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
@@ -149,9 +165,11 @@ single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
val = pmu_read_single(fd);
slept = measured_usleep(batch_duration_ns / 1000);
+ if (flags & TEST_TRAILING_IDLE)
+ end_spin(gem_fd, spin, flags);
val = pmu_read_single(fd) - val;
- igt_spin_batch_end(spin);
+ end_spin(gem_fd, spin, FLAG_SYNC);
igt_spin_batch_free(gem_fd, spin);
close(fd);
@@ -281,7 +299,7 @@ static void log_busy(unsigned int num_engines, uint64_t *val)
static void
busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
- const unsigned int num_engines)
+ const unsigned int num_engines, unsigned int flags)
{
const struct intel_execution_engine2 *e_;
uint64_t tval[2][num_engines];
@@ -309,9 +327,11 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
spin = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
pmu_read_multi(fd[0], num_engines, tval[0]);
slept = measured_usleep(batch_duration_ns / 1000);
+ if (flags & TEST_TRAILING_IDLE)
+ end_spin(gem_fd, spin, flags);
pmu_read_multi(fd[0], num_engines, tval[1]);
- igt_spin_batch_end(spin);
+ end_spin(gem_fd, spin, FLAG_SYNC);
igt_spin_batch_free(gem_fd, spin);
close(fd[0]);
@@ -331,7 +351,7 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
static void
most_busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
- const unsigned int num_engines)
+ const unsigned int num_engines, unsigned int flags)
{
const struct intel_execution_engine2 *e_;
uint64_t tval[2][num_engines];
@@ -375,9 +395,11 @@ most_busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
pmu_read_multi(fd[0], num_engines, tval[0]);
slept = measured_usleep(batch_duration_ns / 1000);
+ if (flags & TEST_TRAILING_IDLE)
+ end_spin(gem_fd, spin, flags);
pmu_read_multi(fd[0], num_engines, tval[1]);
- igt_spin_batch_end(spin);
+ end_spin(gem_fd, spin, FLAG_SYNC);
igt_spin_batch_free(gem_fd, spin);
close(fd[0]);
@@ -396,7 +418,8 @@ most_busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
}
static void
-all_busy_check_all(int gem_fd, const unsigned int num_engines)
+all_busy_check_all(int gem_fd, const unsigned int num_engines,
+ unsigned int flags)
{
const struct intel_execution_engine2 *e;
uint64_t tval[2][num_engines];
@@ -436,9 +459,11 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines)
pmu_read_multi(fd[0], num_engines, tval[0]);
slept = measured_usleep(batch_duration_ns / 1000);
+ if (flags & TEST_TRAILING_IDLE)
+ end_spin(gem_fd, spin, flags);
pmu_read_multi(fd[0], num_engines, tval[1]);
- igt_spin_batch_end(spin);
+ end_spin(gem_fd, spin, FLAG_SYNC);
igt_spin_batch_free(gem_fd, spin);
close(fd[0]);
@@ -464,17 +489,20 @@ no_sema(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
if (flags & TEST_BUSY)
spin = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
+ else
+ spin = NULL;
pmu_read_multi(fd, 2, val[0]);
measured_usleep(batch_duration_ns / 1000);
+ if (flags & TEST_TRAILING_IDLE)
+ end_spin(gem_fd, spin, flags);
pmu_read_multi(fd, 2, val[1]);
val[0][0] = val[1][0] - val[0][0];
val[0][1] = val[1][1] - val[0][1];
- if (flags & TEST_BUSY) {
- igt_spin_batch_end(spin);
- gem_sync(gem_fd, spin->handle);
+ if (spin) {
+ end_spin(gem_fd, spin, FLAG_SYNC);
igt_spin_batch_free(gem_fd, spin);
}
close(fd);
@@ -489,7 +517,8 @@ no_sema(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
#define MI_SEMAPHORE_SAD_GTE_SDD (1<<12)
static void
-sema_wait(int gem_fd, const struct intel_execution_engine2 *e)
+sema_wait(int gem_fd, const struct intel_execution_engine2 *e,
+ unsigned int flags)
{
struct drm_i915_gem_relocation_entry reloc[2] = {};
struct drm_i915_gem_exec_object2 obj[2] = {};
@@ -564,6 +593,8 @@ sema_wait(int gem_fd, const struct intel_execution_engine2 *e)
val[0] = pmu_read_single(fd);
slept = measured_usleep(batch_duration_ns / 1000);
+ if (flags & TEST_TRAILING_IDLE)
+ obj_ptr[0] = 1;
val[1] = pmu_read_single(fd);
igt_debug("slept %.3fms, sampled %.3fms\n",
slept*1e-6, (val[1] - val[0])*1e-6);
@@ -774,6 +805,8 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e)
uint64_t val[2];
int fd[2];
+ gem_quiescent_gpu(gem_fd);
+
fd[0] = open_pmu(config);
/*
@@ -1240,19 +1273,27 @@ igt_main
*/
igt_subtest_f("busy-%s", e->name)
single(fd, e, TEST_BUSY);
+ igt_subtest_f("busy-idle-%s", e->name)
+ single(fd, e, TEST_BUSY | TEST_TRAILING_IDLE);
/**
* Test that when one engine is loaded other report no load.
*/
igt_subtest_f("busy-check-all-%s", e->name)
- busy_check_all(fd, e, num_engines);
+ busy_check_all(fd, e, num_engines, TEST_BUSY);
+ igt_subtest_f("busy-idle-check-all-%s", e->name)
+ busy_check_all(fd, e, num_engines,
+ TEST_BUSY | TEST_TRAILING_IDLE);
/**
* Test that when all except one engine are loaded all loads
* are correctly reported.
*/
igt_subtest_f("most-busy-check-all-%s", e->name)
- most_busy_check_all(fd, e, num_engines);
+ most_busy_check_all(fd, e, num_engines, TEST_BUSY);
+ igt_subtest_f("most-busy-idle-check-all-%s", e->name)
+ most_busy_check_all(fd, e, num_engines,
+ TEST_BUSY | TEST_TRAILING_IDLE);
/**
* Test that semphore counters report no activity on idle
@@ -1264,11 +1305,17 @@ igt_main
igt_subtest_f("busy-no-semaphores-%s", e->name)
no_sema(fd, e, TEST_BUSY);
+ igt_subtest_f("busy-idle-no-semaphores-%s", e->name)
+ no_sema(fd, e, TEST_BUSY | TEST_TRAILING_IDLE);
+
/**
* Test that semaphore waits are correctly reported.
*/
igt_subtest_f("semaphore-wait-%s", e->name)
- sema_wait(fd, e);
+ sema_wait(fd, e, TEST_BUSY);
+
+ igt_subtest_f("semaphore-wait-idle-%s", e->name)
+ sema_wait(fd, e, TEST_BUSY | TEST_TRAILING_IDLE);
/**
* Test that event waits are correctly reported.
@@ -1304,7 +1351,10 @@ igt_main
* correctly reported.
*/
igt_subtest("all-busy-check-all")
- all_busy_check_all(fd, num_engines);
+ all_busy_check_all(fd, num_engines, TEST_BUSY);
+ igt_subtest("all-busy-idle-check-all")
+ all_busy_check_all(fd, num_engines,
+ TEST_BUSY | TEST_TRAILING_IDLE);
/**
* Test that non-engine counters can be initialized and read. Apart
@@ -1361,6 +1411,8 @@ igt_main
for_each_engine_class_instance(fd, e) {
igt_subtest_f("render-node-busy-%s", e->name)
single(fd, e, TEST_BUSY);
+ igt_subtest_f("render-node-busy-idle-%s", e->name)
+ single(fd, e, TEST_BUSY | TEST_TRAILING_IDLE);
}
igt_fixture {
--
2.14.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2018-02-05 11:36 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 18:37 [igt-dev] [PATCH v2 i-g-t 0/9] perf_pmu reliability improvements Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 1/9] tests/perf_pmu: Tighten busy measurement Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 2/9] tests/perf_pmu: More busy measurement tightening Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 3/9] tests/perf_pmu: Use measured sleep in all time based tests Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 4/9] tests/perf_pmu: Convert to flags Tvrtko Ursulin
2018-02-02 20:39 ` Chris Wilson
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 5/9] tests/perf_pmu: Add trailing edge idle test variants Tvrtko Ursulin
2018-02-02 20:45 ` Chris Wilson
2018-02-05 10:32 ` Tvrtko Ursulin
2018-02-05 11:36 ` Tvrtko Ursulin [this message]
2018-02-05 14:08 ` [igt-dev] [PATCH i-g-t v2 " Chris Wilson
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 6/9] tests/perf_pmu: PMU enable race test Tvrtko Ursulin
2018-02-02 20:52 ` Chris Wilson
2018-02-05 10:07 ` Tvrtko Ursulin
2018-02-05 10:16 ` Chris Wilson
2018-02-05 10:40 ` Tvrtko Ursulin
2018-02-05 14:11 ` Chris Wilson
2018-02-05 15:01 ` [igt-dev] [PATCH i-g-t v3 " Tvrtko Ursulin
2018-02-05 11:36 ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-05 14:12 ` Chris Wilson
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 7/9] tests/perf_pmu: Always skip missing engines Tvrtko Ursulin
2018-02-02 20:54 ` Chris Wilson
2018-02-05 11:37 ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-05 14:13 ` Chris Wilson
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 8/9] tests/perf_pmu: Explicitly test for engine availability in init tests Tvrtko Ursulin
2018-02-02 20:57 ` Chris Wilson
2018-02-05 11:37 ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-05 14:14 ` Chris Wilson
2018-02-05 15:02 ` [igt-dev] [PATCH i-g-t v3 " Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 9/9] tests/perf_pmu: Use short batches from hotplug test Tvrtko Ursulin
2018-02-02 21:43 ` Chris Wilson
2018-02-05 11:38 ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-05 14:37 ` Chris Wilson
2018-02-05 11:59 ` [igt-dev] [PATCH i-g-t " Tvrtko Ursulin
2018-02-02 19:18 ` [igt-dev] ✓ Fi.CI.BAT: success for perf_pmu reliability improvements (rev2) Patchwork
2018-02-02 22:20 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-02-05 12:12 ` [igt-dev] ✓ Fi.CI.BAT: success for perf_pmu reliability improvements (rev7) Patchwork
2018-02-05 13:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-02-05 15:21 ` [igt-dev] ✓ Fi.CI.BAT: success for perf_pmu reliability improvements (rev9) Patchwork
2018-02-05 17:35 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180205113612.14694-1-tvrtko.ursulin@linux.intel.com \
--to=tursulin@ursulin.net \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox