From: Riana Tauro <riana.tauro@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: <igt-dev@lists.freedesktop.org>, <anshuman.gupta@intel.com>,
<vinay.belgaumkar@intel.com>, <soham.purkait@intel.com>
Subject: Re: [PATCH i-g-t 3/3] tests/intel/xe_pmu: Add idle engine activity test
Date: Mon, 17 Feb 2025 12:28:29 +0530 [thread overview]
Message-ID: <b0d46f96-204d-4efb-88dd-883eb808e191@intel.com> (raw)
In-Reply-To: <Z6+UnNfsGcQ3QkFf@orsosgc001>
Hi Umesh
On 2/15/2025 12:38 AM, Umesh Nerlige Ramappa wrote:
> On Wed, Feb 12, 2025 at 03:28:29PM +0530, Riana Tauro wrote:
>> Add a test to validate engine is idle by reading PMU counters
>> (engine-active-ticks, engine-total-ticks) when idle
>>
>> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>> ---
>> tests/intel/xe_pmu.c | 35 +++++++++++++++++++++++++++--------
>> 1 file changed, 27 insertions(+), 8 deletions(-)
>>
>> diff --git a/tests/intel/xe_pmu.c b/tests/intel/xe_pmu.c
>> index cbb825755..b47be23ac 100644
>> --- a/tests/intel/xe_pmu.c
>> +++ b/tests/intel/xe_pmu.c
>> @@ -21,6 +21,9 @@
>> #define SLEEP_DURATION 2 /* in seconds */
>> const double tolerance = 0.1;
>>
>> +/* flag masks */
>> +#define TEST_BUSY BIT(0)
>
> s/BUSY/ACTIVE/
Will fix this. copied the i915 names
Will change it throughout the tests
>
>> +
>> #define assert_within_epsilon(x, ref, tolerance) \
>> igt_assert_f((double)(x) <= (1.0 + (tolerance)) * (double)(ref) && \
>> (double)(x) >= (1.0 - (tolerance)) * (double)(ref), \
>> @@ -79,11 +82,13 @@ static uint64_t get_event_config(int xe, unsigned
>> int gt, struct drm_xe_engine_c
>> }
>>
>> /**
>> + * SUBTEST: engine-activity-idle
>> + * Description: Test to validate engine activity shows no load when idle
>> + *
>> * SUBTEST: engine-activity
>> - * Description: Test to validate engine activity stats by running a
>> workload and
>> - * reading the active ticks and total ticks PMU counters
>> + * Description: Test to validate engine activity stats by running
>> full load
>> */
>> -static void engine_activity(int fd, struct
>> drm_xe_engine_class_instance *eci)
>> +static void engine_activity(int fd, struct
>> drm_xe_engine_class_instance *eci, unsigned int flags)
>> {
>> uint64_t config, busy_ticks, total_ticks, before[2], after[2];
>> struct xe_cork *cork = NULL;
>> @@ -97,14 +102,18 @@ static void engine_activity(int fd, struct
>> drm_xe_engine_class_instance *eci)
>> pmu_fd[1] = open_group(fd, config, pmu_fd[0]);
>>
>> vm = xe_vm_create(fd, 0, 0);
>> - cork = xe_cork_create_opts(fd, eci, vm, 1, 1);
>> - xe_cork_sync_start(fd, cork);
>> +
>> + if (flags & TEST_BUSY) {
>> + cork = xe_cork_create_opts(fd, eci, vm, 1, 1);
>> + xe_cork_sync_start(fd, cork);
>> + }
>>
>> pmu_read_multi(pmu_fd[0], 2, before);
>> usleep(SLEEP_DURATION * USEC_PER_SEC);
>
> Usually, I see 3 cases for a single type of test
>
> 1) idle (no spinner is run)
> 2) active (spinner is run, both samples are captured while running).
> 3) active, then idle (spinner is run, capture second sample after ending
> spinner)
>
> Can you also please add case (3). Rest looks good.
Sure will add the trailing idle case
Thanks
Riana
>
> Thanks,
> Umesh
>> pmu_read_multi(pmu_fd[0], 2, after);
>>
>> - xe_cork_sync_end(fd, cork);
>> + if (flags & TEST_BUSY)
>> + xe_cork_sync_end(fd, cork);
>>
>> busy_ticks = after[0] - before[0];
>> total_ticks = after[1] - before[1];
>> @@ -122,7 +131,10 @@ static void engine_activity(int fd, struct
>> drm_xe_engine_class_instance *eci)
>> close(pmu_fd[0]);
>> close(pmu_fd[1]);
>>
>> - assert_within_epsilon(busy_ticks, total_ticks, tolerance);
>> + if (flags & TEST_BUSY)
>> + assert_within_epsilon(busy_ticks, total_ticks, tolerance);
>> + else
>> + igt_assert(!busy_ticks);
>> }
>>
>> igt_main
>> @@ -134,12 +146,19 @@ igt_main
>> fd = drm_open_driver(DRIVER_XE);
>> }
>>
>> + igt_describe("Validate there is no engine activity when idle");
>> + igt_subtest_with_dynamic("engine-activity-idle")
>> + xe_for_each_engine(fd, hwe)
>> + igt_dynamic_f("engine-%s%d", xe_engine_class_string(hwe-
>> >engine_class),
>> + hwe->engine_instance)
>> + engine_activity(fd, hwe, 0);
>> +
>> igt_describe("Validate engine activity with workload running by
>> reading pmu counters");
>> igt_subtest_with_dynamic("engine-activity")
>> xe_for_each_engine(fd, hwe)
>> igt_dynamic_f("engine-%s%d", xe_engine_class_string(hwe-
>> >engine_class),
>> hwe->engine_instance)
>> - engine_activity(fd, hwe);
>> + engine_activity(fd, hwe, TEST_BUSY);
>>
>> igt_fixture {
>> close(fd);
>> --
>> 2.47.1
>>
next prev parent reply other threads:[~2025-02-17 6:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 9:58 [PATCH i-g-t 0/3] Add PMU tests to validate engine activity Riana Tauro
2025-02-12 9:58 ` [PATCH i-g-t 1/3] lib/igt_perf: Add utils to extract PMU event info Riana Tauro
2025-02-13 14:30 ` Kamil Konieczny
2025-02-16 11:26 ` Purkait, Soham
2025-02-12 9:58 ` [PATCH i-g-t 2/3] tests/intel/xe_pmu: Add PMU test to validate engine activity stats Riana Tauro
2025-02-14 18:55 ` Umesh Nerlige Ramappa
2025-02-14 19:01 ` Umesh Nerlige Ramappa
2025-02-12 9:58 ` [PATCH i-g-t 3/3] tests/intel/xe_pmu: Add idle engine activity test Riana Tauro
2025-02-14 19:08 ` Umesh Nerlige Ramappa
2025-02-17 6:58 ` Riana Tauro [this message]
2025-02-13 1:07 ` ✓ Xe.CI.BAT: success for Add PMU tests to validate engine activity Patchwork
2025-02-13 1:20 ` ✓ i915.CI.BAT: " Patchwork
2025-02-13 10:04 ` ✗ i915.CI.Full: failure " Patchwork
2025-02-13 12:03 ` ✗ Xe.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=b0d46f96-204d-4efb-88dd-883eb808e191@intel.com \
--to=riana.tauro@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=soham.purkait@intel.com \
--cc=umesh.nerlige.ramappa@intel.com \
--cc=vinay.belgaumkar@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