From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: Riana Tauro <riana.tauro@intel.com>
Cc: <igt-dev@lists.freedesktop.org>, <anshuman.gupta@intel.com>,
<lucas.demarchi@intel.com>, <michal.wajdeczko@intel.com>,
<satyanarayana.k.v.p@intel.com>
Subject: Re: [PATCH i-g-t v3 3/3] tests/intel/xe_pmu: Add a test to validate engine activity on a function
Date: Fri, 21 Mar 2025 13:50:49 -0700 [thread overview]
Message-ID: <Z93RKX27VZA4sYR8@soc-5CG1426VCC.clients.intel.com> (raw)
In-Reply-To: <20250321110958.3557106-4-riana.tauro@intel.com>
On Fri, Mar 21, 2025 at 04:39:58PM +0530, Riana Tauro wrote:
>Add two tests to run workload on one function at a time with different
>scheduling policies. If sched-if-idle is set to true, then the functions
>use the execution quantum even if idle
>
>v2: add additional test for sched if idle (Umesh)
>
>Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>---
> tests/intel/xe_pmu.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 85 insertions(+)
>
>diff --git a/tests/intel/xe_pmu.c b/tests/intel/xe_pmu.c
>index 9a1f9b39e..5aa3ea332 100644
>--- a/tests/intel/xe_pmu.c
>+++ b/tests/intel/xe_pmu.c
>@@ -29,6 +29,7 @@
>
> const double tolerance = 0.1;
> static char xe_device[NAME_MAX];
>+static int total_exec_quantum;
>
> #define test_each_engine(test, fd, hwe) \
> igt_subtest_with_dynamic(test) \
>@@ -262,6 +263,76 @@ static void engine_activity_all_fn(int fd, struct drm_xe_engine_class_instance *
> }
> }
>
>+/**
>+ * SUBTEST: fn-engine-activity-load
>+ * Description: Test to validate engine activity by running load on a function
>+ *
>+ * SUBTEST: fn-engine-activity-sched-if-idle
>+ * Description: Test to validate engine activity by running load on a function
>+ */
>+static void engine_activity_fn(int fd, struct drm_xe_engine_class_instance *eci, int function)
>+{
>+ uint64_t config, engine_active_ticks, engine_total_ticks, before[2], after[2];
>+ double busy_percent, exec_quantum_ratio;
>+ struct xe_cork *cork = NULL;
>+ int pmu_fd[2], fn_fd;
>+ bool sched_if_idle;
>+ uint32_t vm;
>+
>+ if (function > 0) {
>+ fn_fd = igt_sriov_open_vf_drm_device(fd, function);
>+ igt_assert_fd(fn_fd);
>+ } else {
>+ fn_fd = fd;
>+ }
>+
>+ config = get_event_config_fn(eci->gt_id, function, eci, "engine-active-ticks");
>+ pmu_fd[0] = open_group(fd, config, -1);
>+
>+ config = get_event_config_fn(eci->gt_id, function, eci, "engine-total-ticks");
>+ pmu_fd[1] = open_group(fd, config, pmu_fd[0]);
>+
>+ vm = xe_vm_create(fn_fd, 0, 0);
>+ cork = xe_cork_create_opts(fn_fd, eci, vm, 1, 1);
>+ xe_cork_sync_start(fn_fd, cork);
>+
>+ pmu_read_multi(pmu_fd[0], 2, before);
>+ usleep(SLEEP_DURATION * USEC_PER_SEC);
>+ pmu_read_multi(pmu_fd[0], 2, after);
>+
>+ xe_cork_sync_end(fn_fd, cork);
>+
>+ engine_active_ticks = after[0] - before[0];
>+ engine_total_ticks = after[1] - before[1];
>+
>+ igt_debug("[%d] Engine active ticks: after %ld, before %ld delta %ld\n", function,
>+ after[0], before[0], engine_active_ticks);
>+ igt_debug("[%d] Engine total ticks: after %ld, before %ld delta %ld\n", function,
>+ after[1], before[1], engine_total_ticks);
>+
>+ busy_percent = (double)engine_active_ticks / engine_total_ticks;
>+ exec_quantum_ratio = (double)total_exec_quantum / xe_sriov_get_exec_quantum_ms(fd, function, eci->gt_id);
>+
>+ igt_debug("Percent %lf\n", busy_percent * 100);
>+
>+ if (cork)
>+ xe_cork_destroy(fn_fd, cork);
>+
>+ xe_vm_destroy(fn_fd, vm);
>+
>+ close(pmu_fd[0]);
>+ close(pmu_fd[1]);
>+
>+ if (function > 0)
>+ close(fn_fd);
>+
>+ sched_if_idle = xe_sriov_get_sched_if_idle(fd, eci->gt_id);
>+ if (sched_if_idle)
>+ assert_within_epsilon(engine_active_ticks, engine_total_ticks, tolerance);
>+ else
>+ assert_within_epsilon(busy_percent, exec_quantum_ratio, tolerance);
>+}
Test looks good. With the comments in Patch 2 addressed, this is:
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Thanks,
Umesh
>+
> /**
> * SUBTEST: gt-c6-idle
> * Description: Basic residency test to validate idle residency
>@@ -324,6 +395,8 @@ static unsigned int enable_and_provision_vfs(int fd)
> for (vf = 1; vf <= num_vfs; vf++)
> igt_sriov_bind_vf_drm_driver(fd, vf);
>
>+ total_exec_quantum = pf_exec_quantum + (num_vfs * vf_exec_quantum);
>+
> return num_vfs;
> }
>
>@@ -371,6 +444,18 @@ igt_main
> test_each_engine("all-fn-engine-activity-load", fd, eci)
> engine_activity_all_fn(fd, eci, num_fns);
>
>+ igt_describe("Validate per-function engine activity");
>+ test_each_engine("fn-engine-activity-load", fd, eci)
>+ for (int fn = 0; fn < num_fns; fn++)
>+ engine_activity_fn(fd, eci, fn);
>+
>+ igt_describe("Validate per-function engine activity when sched-if-idle is set");
>+ test_each_engine("fn-engine-activity-sched-if-idle", fd, eci) {
>+ xe_sriov_set_sched_if_idle(fd, eci->gt_id, 1);
>+ for (int fn = 0; fn < num_fns; fn++)
>+ engine_activity_fn(fd, eci, fn);
>+ }
>+
> igt_fixture {
> igt_sriov_disable_vfs(fd);
> /* abort to avoid execution of next tests with enabled VFs */
>--
>2.47.1
>
next prev parent reply other threads:[~2025-03-21 20:51 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 11:09 [PATCH i-g-t v3 0/3] Add engine activity tests for functions Riana Tauro
2025-03-21 11:09 ` [PATCH i-g-t v3 1/3] tests/intel/xe_pmu: move xe perf device to fixture Riana Tauro
2025-03-21 19:30 ` Umesh Nerlige Ramappa
2025-03-24 5:30 ` K V P, Satyanarayana
2025-03-21 11:09 ` [PATCH i-g-t v3 2/3] tests/intel/xe_pmu: Add engine activity test for all functions Riana Tauro
2025-03-21 20:45 ` Umesh Nerlige Ramappa
2025-03-24 5:24 ` Riana Tauro
2025-03-24 17:25 ` Umesh Nerlige Ramappa
2025-03-24 5:43 ` K V P, Satyanarayana
2025-03-26 10:50 ` Bernatowicz, Marcin
2025-03-27 10:04 ` Riana Tauro
2025-03-21 11:09 ` [PATCH i-g-t v3 3/3] tests/intel/xe_pmu: Add a test to validate engine activity on a function Riana Tauro
2025-03-21 20:50 ` Umesh Nerlige Ramappa [this message]
2025-03-24 17:27 ` Umesh Nerlige Ramappa
2025-03-21 18:54 ` ✓ Xe.CI.BAT: success for Add engine activity tests for functions (rev2) Patchwork
2025-03-21 19:12 ` ✓ i915.CI.BAT: " Patchwork
2025-03-21 20:54 ` ✗ Xe.CI.Full: failure " Patchwork
2025-03-21 23:13 ` ✗ i915.CI.Full: " 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=Z93RKX27VZA4sYR8@soc-5CG1426VCC.clients.intel.com \
--to=umesh.nerlige.ramappa@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=riana.tauro@intel.com \
--cc=satyanarayana.k.v.p@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