From: Riana Tauro <riana.tauro@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
<igt-dev@lists.freedesktop.org>, <badal.nilawar@intel.com>,
"Gupta, Anshuman" <anshuman.gupta@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test
Date: Wed, 21 Jun 2023 10:01:07 +0530 [thread overview]
Message-ID: <9f52c553-f88f-09de-16e1-7983bc1fbc2d@intel.com> (raw)
In-Reply-To: <20230614132755.vet5lamnk77m6r6s@kamilkon-desk1>
Hi Kamil
On 6/14/2023 6:57 PM, Kamil Konieczny wrote:
> Hi Riana,
>
> On 2023-06-13 at 15:17:24 +0530, Riana Tauro wrote:
>>
>>
>> On 6/12/2023 6:59 PM, Kamil Konieczny wrote:
>>> Hi Riana,
>>>
>>> On 2023-06-09 at 15:14:57 +0530, Riana Tauro wrote:
>>>> The test reads idle residency within a time interval and
>>>> checks if its within the tolerance
>>>>
>>>> Currently the test checks RC6 Residency
>>>>
>>>> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>>>> ---
>>>> tests/meson.build | 1 +
>>>> tests/xe/xe_gt_idle.c | 117 ++++++++++++++++++++++++++++++++++++++++++
>>>> 2 files changed, 118 insertions(+)
>>>> create mode 100644 tests/xe/xe_gt_idle.c
>>>>
>>>> diff --git a/tests/meson.build b/tests/meson.build
>>>> index c15eb3a08..10273ebf5 100644
>>>> --- a/tests/meson.build
>>>> +++ b/tests/meson.build
>>>> @@ -254,6 +254,7 @@ xe_progs = [
>>>> 'xe_exec_fault_mode',
>>>> 'xe_exec_reset',
>>>> 'xe_exec_threads',
>>>> + 'xe_gt_idle',
>>>
>>> Could you change name to xe_pm or xe_power?
>>> imho xe_pm is better name.
>>
>> Hi Kamil
>>
>> There is already a test with xe_pm [Suspend tests].
>> This patch is a test for https://patchwork.freedesktop.org/series/119262/
>> [gtidle properties]
>
> Thank you for pointing this, please include it also in your
> commit description also with name of patch series (as links
> can later dissapear).
Sure will add it
>
>>
>> Is xe_gt_idle okay? or should i rename it to xe_pm_residency?
>>
>> Thanks
>> Riana
>
> This looks better: xe_pm_residency
>
> These are i915 tests related to pm:
>
> ls -1 |grep _pm_
>
> i915_pm_backlight.c
> i915_pm_dc.c
> i915_pm_freq_api.c
> i915_pm_freq_mult.c
> i915_pm_lpsp.c
> i915_pm_rc6_residency.c
> i915_pm_rpm.c
> i915_pm_rps.c
> i915_pm_sseu.c
>
> Why not make it a subtest in xe_pm.c ?
There will be 4-6 more tests for status & residency.
Will rename it to xe_pm_residency as xe_pm has tests related to suspend
Thanks
Riana
>
> Regards,
> Kamil
>
>>
>>
>>>
>>> Regards,
>>> Kamil
>>>
>>>> 'xe_gpgpu_fill',
>>>> 'xe_guc_pc',
>>>> 'xe_huc_copy',
>>>> diff --git a/tests/xe/xe_gt_idle.c b/tests/xe/xe_gt_idle.c
>>>> new file mode 100644
>>>> index 000000000..3a1090ffd
>>>> --- /dev/null
>>>> +++ b/tests/xe/xe_gt_idle.c
>>>> @@ -0,0 +1,117 @@
>>>> +// SPDX-License-Identifier: MIT
>>>> +/*
>>>> + * Copyright © 2023 Intel Corporation
>>>> + */
>>>> +
>>>> +/**
>>>> + * TEST: Test gtidle properties
>>>> + * Category: Software building block
>>>> + * Sub-category: Power Management
>>>> + * Functionality: RC6
>>>> + * Test category: functionality test
>>>> + */
>>>> +
>>>> +#include <limits.h>
>>>> +
>>>> +#include "igt.h"
>>>> +#include "igt_sysfs.h"
>>>> +
>>>> +#include "xe/xe_query.h"
>>>> +
>>>> +#define SLEEP_DURATION 3 /* in seconds */
>>>> +
>>>> +const double tolerance = 0.1;
>>>> +
>>>> +#define assert_within_epsilon(x, ref, tol) \
>>>> + igt_assert_f((double)(x) <= (1.0 + (tol)) * (double)(ref) && \
>>>> + (double)(x) >= (1.0 - (tol)) * (double)(ref), \
>>>> + "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n",\
>>>> + #x, #ref, (double)(x), \
>>>> + (tol) * 100.0, (tol) * 100.0, \
>>>> + (double)(ref))
>>>> +
>>>> +static bool in_rc6(int sysfs, int gt)
>>>> +{
>>>> + char path[PATH_MAX];
>>>> + char rc[8];
>>>> +
>>>> + sprintf(path, "device/gt%d/gtidle/idle_status", gt);
>>>> + if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>>>> + return false;
>>>> +
>>>> + return strcmp(rc, "rc6") == 0;
>>>> +}
>>>> +
>>>> +static bool is_rc_dir(int sysfs, int gt)
>>>> +{
>>>> + char path[PATH_MAX], name[NAME_MAX];
>>>> + char rc[8];
>>>> +
>>>> + sprintf(path, "device/gt%d/gtidle/name", gt);
>>>> + if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>>>> + return false;
>>>> +
>>>> + sprintf(name, "gt%d-rc", gt);
>>>> + return strcmp(rc, name) == 0;
>>>> +}
>>>> +
>>>> +static unsigned long read_idle_residency(int sysfs, int gt)
>>>> +{
>>>> + unsigned long residency;
>>>> + char path[PATH_MAX];
>>>> +
>>>> + residency = 0;
>>>> + sprintf(path, "device/gt%d/gtidle/idle_residency_ms", gt);
>>>> + igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
>>>> + return residency;
>>>> +}
>>>> +
>>>> +/**
>>>> + * SUBTEST: idle-residency
>>>> + * Description: basic residency test to check idle residency
>>>> + * within a time interval
>>>> + * Run type: FULL
>>>> + */
>>>> +static void test_idle(int sysfs, int gt)
>>>> +{
>>>> + struct timespec tv;
>>>> + unsigned long elapsed_ms, residency_start, residency_end;
>>>> +
>>>> + assert(is_rc_dir(sysfs, gt));
>>>> + assert(igt_wait(in_rc6(sysfs, gt), 1000, 1));
>>>> +
>>>> + igt_gettime(&tv);
>>>> + residency_start = read_idle_residency(sysfs, gt);
>>>> + sleep(SLEEP_DURATION);
>>>> + residency_end = read_idle_residency(sysfs, gt);
>>>> + elapsed_ms = igt_nsec_elapsed(&tv) / 1000000;
>>>> +
>>>> + igt_info("Measured %lums of idle residency in %lums\n",
>>>> + residency_end - residency_start, elapsed_ms);
>>>> +
>>>> + assert_within_epsilon(residency_end - residency_start, elapsed_ms, tolerance);
>>>> +}
>>>> +
>>>> +igt_main
>>>> +{
>>>> + int fd, gt;
>>>> + static int sysfs = -1;
>>>> +
>>>> + igt_fixture {
>>>> + fd = drm_open_driver(DRIVER_XE);
>>>> +
>>>> + xe_device_get(fd);
>>>> + sysfs = igt_sysfs_open(fd);
>>>> + igt_assert(sysfs != -1);
>>>> + }
>>>> +
>>>> + igt_subtest("idle-residency")
>>>> + xe_for_each_gt(fd, gt)
>>>> + test_idle(sysfs, gt);
>>>> +
>>>> + igt_fixture {
>>>> + close(sysfs);
>>>> + xe_device_put(fd);
>>>> + close(fd);
>>>> + }
>>>> +}
>>>> --
>>>> 2.40.0
>>>>
next prev parent reply other threads:[~2023-06-21 4:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 9:44 [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test Riana Tauro
2023-06-09 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-06-10 23:43 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-06-12 13:29 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny
2023-06-13 9:47 ` Riana Tauro
2023-06-14 13:27 ` Kamil Konieczny
2023-06-21 4:31 ` Riana Tauro [this message]
2023-06-14 15:58 ` Nilawar, Badal
2023-06-15 7:57 ` Riana Tauro
2023-06-15 11:33 ` Nilawar, Badal
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=9f52c553-f88f-09de-16e1-7983bc1fbc2d@intel.com \
--to=riana.tauro@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.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