From: Katarzyna Dec <katarzyna.dec@intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: igt-dev@lists.freedesktop.org, Petri Latvala <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 7/8] perf_pmu: Use dynamic subtests
Date: Fri, 8 Nov 2019 17:13:00 +0100 [thread overview]
Message-ID: <20191108161300.GE28532@kdec5-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20191024110546.25569-8-petri.latvala@intel.com>
On Thu, Oct 24, 2019 at 02:05:45PM +0300, Petri Latvala wrote:
> Instead of generating a subtest for each engine in a static list,
> convert to dynamic subtests, with one dynamic subtest per actually
> present physical engine.
>
> In addition, convert comments to igt_describe calls and generally
> refactor the lot to a series of simpler loops.
Tvrko, is there a chance you could look at dynamic engines usage here and give
r-b? It will allow us to merge whole series.
Have a nice day!
Kasia :)
>
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> ---
> tests/perf_pmu.c | 244 ++++++++++++++++++++---------------------------
> 1 file changed, 105 insertions(+), 139 deletions(-)
>
> diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
> index e2bd2cc5..6a4a600e 100644
> --- a/tests/perf_pmu.c
> +++ b/tests/perf_pmu.c
> @@ -270,7 +270,7 @@ static void end_spin(int fd, igt_spin_t *spin, unsigned int flags)
> }
>
> static void
> -single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
> +single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int num_engines, unsigned int flags)
> {
> unsigned long slept;
> igt_spin_t *spin;
> @@ -606,7 +606,7 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines,
> }
>
> static void
> -no_sema(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
> +no_sema(int gem_fd, const struct intel_execution_engine2 *e, unsigned int num_engines, unsigned int flags)
> {
> igt_spin_t *spin;
> uint64_t val[2][2];
> @@ -646,7 +646,7 @@ no_sema(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
>
> static void
> sema_wait(int gem_fd, const struct intel_execution_engine2 *e,
> - unsigned int flags)
> + unsigned int num_engines, unsigned int flags)
> {
> struct drm_i915_gem_relocation_entry reloc[2] = {};
> struct drm_i915_gem_exec_object2 obj[2] = {};
> @@ -809,6 +809,7 @@ __sema_busy(int gem_fd, int pmu,
> static void
> sema_busy(int gem_fd,
> const struct intel_execution_engine2 *e,
> + unsigned int num_engines,
> unsigned int flags)
> {
> const struct intel_execution_engine2 *signal;
> @@ -1770,6 +1771,27 @@ igt_main
> int fd = -1;
> struct intel_execution_engine2 *e;
> unsigned int i;
> + const unsigned int pct[] = { 2, 50, 98 };
> + struct {
> + void (*func)(int, const struct intel_execution_engine2 *, unsigned int, unsigned int);
> + const char *name;
> + unsigned int flags;
> + const char *desc;
> + } busyidle_tests[] = {
> + { single, "idle", 0, "Test that engines show no load when idle." },
> + { single, "busy", TEST_BUSY, "Test that a single engine reports load correctly." },
> + { single, "busy-idle", TEST_BUSY | TEST_TRAILING_IDLE, "Test that a single engine reports load correctly." },
> + { busy_check_all, "busy-check-all", TEST_BUSY, "Test that when one engine is loaded, others report no load." },
> + { busy_check_all, "busy-idle-check-all", TEST_BUSY | TEST_TRAILING_IDLE, "Test that one one engine is loaded, others report no load." },
> + { most_busy_check_all, "most-busy-check-all", TEST_BUSY, "Test that when all except one engine are loaded all loads are correctly reported." },
> + { most_busy_check_all, "most-busy-idle-check-all", TEST_BUSY | TEST_TRAILING_IDLE, "Test that when all except one engine are loaded all loads are correctly reported." },
> + { no_sema, "idle-no-semaphores", 0, "Test that semaphore counters report no activity on idle engines." },
> + { no_sema, "busy-no-semaphores", TEST_BUSY, "Test that semaphore counters report no activity on busy engines." },
> + { no_sema, "busy-idle-no-semaphores", TEST_BUSY | TEST_TRAILING_IDLE, "Test that semaphore counters report no activity on idle or busy engines." },
> + { sema_wait, "semaphore-wait", TEST_BUSY, "Test that semaphore waits are correctly reported." },
> + { sema_wait, "semaphore-wait-idle", TEST_BUSY | TEST_TRAILING_IDLE, "Test that semaphore waits are correctly reported." },
> + { sema_busy, "semaphore-busy", 0, "Test that semaphore time and busy time difference is under a threshold." },
> + };
>
> igt_fixture {
> fd = drm_open_driver_master(DRIVER_INTEL);
> @@ -1781,144 +1803,89 @@ igt_main
> num_engines++;
> }
>
> - /**
> - * Test invalid access via perf API is rejected.
> - */
> + igt_describe("Test that invalid access via perf API is rejected.");
> igt_subtest("invalid-init")
> invalid_init();
>
> - __for_each_physical_engine(fd, e) {
> - const unsigned int pct[] = { 2, 50, 98 };
> -
> - /**
> - * Test that a single engine metric can be initialized or it
> - * is correctly rejected.
> - */
> - igt_subtest_f("init-busy-%s", e->name)
> - init(fd, e, I915_SAMPLE_BUSY);
> -
> - igt_subtest_f("init-wait-%s", e->name)
> - init(fd, e, I915_SAMPLE_WAIT);
> -
> - igt_subtest_f("init-sema-%s", e->name)
> - init(fd, e, I915_SAMPLE_SEMA);
> -
> - /**
> - * Test that engines show no load when idle.
> - */
> - igt_subtest_f("idle-%s", e->name)
> - single(fd, e, 0);
> -
> - /**
> - * Test that a single engine reports load correctly.
> - */
> - 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, 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,
> - 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 or busy engines.
> - */
> - igt_subtest_f("idle-no-semaphores-%s", e->name)
> - no_sema(fd, e, 0);
> -
> - 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, TEST_BUSY);
> -
> - igt_subtest_f("semaphore-wait-idle-%s", e->name)
> - sema_wait(fd, e,
> - TEST_BUSY | TEST_TRAILING_IDLE);
> + igt_describe("Test that a single engine metric can be initialized "
> + "or it is correctly rejected.");
> + igt_subtest_with_dynamic_subsubtests("init-busy")
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + init(fd, e, I915_SAMPLE_BUSY);
>
> - igt_subtest_f("semaphore-busy-%s", e->name)
> - sema_busy(fd, e, 0);
> + igt_describe("Test that a single engine metric can be initialized "
> + "or it is correctly rejected.");
> + igt_subtest_with_dynamic_subsubtests("init-wait")
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + init(fd, e, I915_SAMPLE_WAIT);
>
> - /**
> - * Check that two perf clients do not influence each
> - * others observations.
> - */
> - igt_subtest_f("multi-client-%s", e->name)
> - multi_client(fd, e);
> + igt_describe("Test that a single engine metric can be initialized "
> + "or it is correctly rejected.");
> + igt_subtest_with_dynamic_subsubtests("init-sema")
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + init(fd, e, I915_SAMPLE_SEMA);
> +
> + for (i = 0; i < ARRAY_SIZE(busyidle_tests); i++) {
> + igt_describe(busyidle_tests[i].desc);
> + igt_subtest_with_dynamic_subsubtests(busyidle_tests[i].name)
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + busyidle_tests[i].func(fd, e, num_engines, busyidle_tests[i].flags);
> + }
>
> - /**
> - * 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);
> + igt_describe("Check that two perf clients do not influence each other's observations.");
> + igt_subtest_with_dynamic_subsubtests("multi-client")
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + multi_client(fd, e);
>
> - /**
> - * Check that reported usage is correct when PMU is
> - * enabled after two batches are running.
> - */
> - igt_subtest_f("busy-double-start-%s", e->name) {
> - gem_require_contexts(fd);
> - busy_double_start(fd, e);
> - }
> + igt_describe("Check that reported usage is correct when PMU is enabled after the batch is running.");
> + igt_subtest_with_dynamic_subsubtests("busy-start")
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + busy_start(fd, e);
>
> - /**
> - * Check that the PMU can be safely enabled in face of
> - * interrupt-heavy engine load.
> - */
> - igt_subtest_f("enable-race-%s", e->name)
> - test_enable_race(fd, e);
> + igt_describe("Check that reported usage is correct when PMU is enabled after two batches are running.");
> + igt_subtest_with_dynamic_subsubtests("busy-double-start") {
> + gem_require_contexts(fd);
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + busy_double_start(fd, e);
> + }
>
> - /**
> - * Check engine busyness accuracy is as expected.
> - */
> - for (i = 0; i < ARRAY_SIZE(pct); i++) {
> - igt_subtest_f("busy-accuracy-%u-%s",
> - pct[i], e->name)
> - accuracy(fd, e, pct[i], 10);
> - }
> + igt_describe("Check that the PMU can be safely enabled in face of interrupt-heavy engine load.");
> + igt_subtest_with_dynamic_subsubtests("enable-race")
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + test_enable_race(fd, e);
> +
> + for (i = 0; i < ARRAY_SIZE(pct); i++) {
> + igt_describe("Check engine busyness accuracy is as expected.");
> + igt_subtest_with_dynamic_subsubtests_f("busy-accuracy-%u", pct[i])
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + accuracy(fd, e, pct[i], 10);
> + }
>
> - igt_subtest_f("busy-hang-%s", e->name) {
> - igt_hang_t hang = igt_allow_hang(fd, 0, 0);
> + igt_subtest_with_dynamic_subsubtests("busy-hang")
> + __for_each_physical_engine(fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name) {
> + igt_hang_t hang = igt_allow_hang(fd, 0, 0);
>
> - single(fd, e, TEST_BUSY | FLAG_HANG);
> + single(fd, e, 0, TEST_BUSY | FLAG_HANG);
>
> - igt_disallow_hang(fd, hang);
> - }
> + igt_disallow_hang(fd, hang);
> + }
>
> - /**
> - * Test that event waits are correctly reported.
> - */
> - if (e->class == I915_ENGINE_CLASS_RENDER)
> - igt_subtest_f("event-wait-%s", e->name)
> - event_wait(fd, e);
> - }
> + igt_describe("Test that event waits are correctly reported.");
> + igt_subtest_with_dynamic_subsubtests("event-wait")
> + __for_each_physical_engine(fd, e)
> + if (e->class == I915_ENGINE_CLASS_RENDER)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + event_wait(fd, e);
>
> /**
> * Test that when all engines are loaded all loads are
> @@ -1975,9 +1942,7 @@ igt_main
> igt_subtest("rc6-runtime-pm-long")
> test_rc6(fd, TEST_RUNTIME_PM | FLAG_LONG);
>
> - /**
> - * Check render nodes are counted.
> - */
> + igt_describe("Check that render nodes are counted.");
> igt_subtest_group {
> int render_fd = -1;
>
> @@ -1988,14 +1953,15 @@ igt_main
> gem_quiescent_gpu(fd);
> }
>
> - __for_each_physical_engine(render_fd, e) {
> - igt_subtest_f("render-node-busy-%s", e->name)
> - single(render_fd, e, TEST_BUSY);
> - igt_subtest_f("render-node-busy-idle-%s",
> - e->name)
> - single(render_fd, e,
> - TEST_BUSY | TEST_TRAILING_IDLE);
> - }
> + igt_subtest_with_dynamic_subsubtests("render-node-busy")
> + __for_each_physical_engine(render_fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + single(render_fd, e, 0, TEST_BUSY);
> +
> + igt_subtest_with_dynamic_subsubtests("render-node-busy-idle")
> + __for_each_physical_engine(render_fd, e)
> + igt_dynamic_subsubtest_f("%s", e->name)
> + single(render_fd, e, 0, TEST_BUSY | TEST_TRAILING_IDLE);
>
> igt_fixture {
> close(render_fd);
> --
> 2.19.1
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-11-08 16:13 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 11:05 [igt-dev] [PATCH i-g-t 0/8] Dynamic subtests, v3 Petri Latvala
2019-10-24 11:05 ` [igt-dev] [PATCH i-g-t 1/8] lib: Introduce dynamic subsubtests Petri Latvala
2019-10-25 7:49 ` Arkadiusz Hiler
2019-11-11 10:11 ` [igt-dev] [PATCH i-g-t v4 " Petri Latvala
2019-10-24 11:05 ` [igt-dev] [PATCH i-g-t 2/8] lib/tests: Unit tests for dynamic subtests Petri Latvala
2019-10-25 8:05 ` Arkadiusz Hiler
2019-10-24 11:05 ` [igt-dev] [PATCH i-g-t 3/8] lib/tests: Test that igt_describe works with " Petri Latvala
2019-10-25 9:35 ` Arkadiusz Hiler
2019-10-24 11:05 ` [igt-dev] [PATCH i-g-t 4/8] runner: Parse dynamic subtest outputs and results Petri Latvala
2019-10-25 11:03 ` Arkadiusz Hiler
2019-10-24 11:05 ` [igt-dev] [PATCH i-g-t 5/8] runner/json_tests: Test dynamic subtests Petri Latvala
2019-10-25 11:22 ` Arkadiusz Hiler
2019-10-24 11:05 ` [igt-dev] [PATCH i-g-t 6/8] kms_plane_cursor: Use " Petri Latvala
2019-11-08 16:15 ` Katarzyna Dec
2019-11-14 12:03 ` Petri Latvala
2019-10-24 11:05 ` [igt-dev] [PATCH i-g-t 7/8] perf_pmu: " Petri Latvala
2019-11-08 16:13 ` Katarzyna Dec [this message]
2019-11-08 16:27 ` Tvrtko Ursulin
2019-10-24 11:05 ` [igt-dev] [PATCH i-g-t 8/8] i915/gem_exec_basic: " Petri Latvala
2019-11-05 9:24 ` Katarzyna Dec
2019-11-08 16:31 ` Tvrtko Ursulin
2019-11-08 16:33 ` Tvrtko Ursulin
2019-11-11 10:06 ` Petri Latvala
2019-11-11 10:36 ` Tvrtko Ursulin
2019-10-24 13:50 ` [igt-dev] ✗ GitLab.Pipeline: warning for Dynamic subtests (rev3) Patchwork
2019-10-24 13:58 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-10-25 19:08 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-11-11 11:22 ` [igt-dev] ✓ Fi.CI.BAT: success for Dynamic subtests (rev4) Patchwork
2019-11-11 13:51 ` [igt-dev] ✗ GitLab.Pipeline: failure " Patchwork
2019-11-11 20:15 ` [igt-dev] ✓ Fi.CI.IGT: success " 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=20191108161300.GE28532@kdec5-desk.ger.corp.intel.com \
--to=katarzyna.dec@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@intel.com \
--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