From: Imre Deak <imre.deak@intel.com>
To: Swati Sharma <swati2.sharma@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v5 4/5] tests/i915/i915_pm_dc: Modify dc9 test
Date: Mon, 12 Sep 2022 16:23:01 +0300 [thread overview]
Message-ID: <Yx8ytepV2brDMFSD@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20220909114911.1852-5-swati2.sharma@intel.com>
On Fri, Sep 09, 2022 at 05:19:10PM +0530, Swati Sharma wrote:
> Existing dc9 test is modified. Added new condition,
> runtime_suspended_time value should increases when system
> enters dc9. This condition will be checked for both igfx
> and dgfx whereas existing condition where we wait for
> dc counter to reset is limited only to igfx.
>
> v3: -changed test design (imre)
> v4: -var name changed (imre)
> -restricted counter reset condition to dg1 and dg2
> platforms only (anshuman)
> -swapped rpm vs dc9 wait order condition (imre)
> v5: -add macro DC9_RESETS_DC_COUNTERS (imre)
> -combine both polling (imre)
> -moved is_dgfx() realignment into patch 2/4 (imre)
> -s/seconds/msecs/ (imre)
>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
> tests/i915/i915_pm_dc.c | 54 ++++++++++++++++++++++++++++-------------
> 1 file changed, 37 insertions(+), 17 deletions(-)
>
> diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
> index bd4522275..142975e6c 100644
> --- a/tests/i915/i915_pm_dc.c
> +++ b/tests/i915/i915_pm_dc.c
> @@ -31,8 +31,11 @@
> #include "igt_kmod.h"
> #include "igt_psr.h"
> #include "igt_sysfs.h"
> +#include "igt_device.h"
> +#include "igt_device_scan.h"
> #include "limits.h"
> #include "time.h"
> +#include "igt_pm.h"
>
> /* DC State Flags */
> #define CHECK_DC5 (1 << 0)
> @@ -43,6 +46,7 @@
> #define RPM_STATUS "i915_runtime_pm_status"
> #define KMS_HELPER "/sys/module/drm_kms_helper/parameters/"
> #define KMS_POLL_DISABLE 0
> +#define DC9_RESETS_DC_COUNTERS(devid) !(IS_DG1(devid) || IS_DG2(devid))
Parens missing around the whole macro definition.
> IGT_TEST_DESCRIPTION("Tests to validate display power DC states.");
>
> @@ -416,42 +420,58 @@ static bool support_dc6(int debugfs_fd)
> return strstr(buf, "DC5 -> DC6 count");
> }
>
> -static bool dc9_wait_entry(uint32_t debugfs_fd, int dc_target, int prev_dc, int seconds)
> +static int read_runtime_suspended_time(int drm_fd)
> {
> - /*
> - * since we do not have DC9 counter,
> - * so we rely on dc5/dc6 counter reset to check if display engine was in DC9.
> + struct pci_device *i915;
> + int ret;
> +
> + i915 = igt_device_get_pci_device(drm_fd);
> + ret = igt_pm_get_runtime_suspended_time(i915);
> + igt_assert_lte(0, ret);
> +
> + return ret;
> +}
> +
> +static bool dc9_wait_entry(data_t *data, int dc_target, int prev_dc, int prev_rpm, int msecs)
> +{
> + /* runtime suspended residency should increment once DC9 is achieved;
> + * this condition is valid for all platforms.
> + * however, resetting of dc5/dc6 counter to check if display engine was in DC9;
> + * this condition at present can be skipped for dg1 and dg2 platforms.
> */
The above should follow the multiline comment format.
> - return igt_wait(read_dc_counter(debugfs_fd, dc_target) <
> - prev_dc, seconds, 100);
> + return igt_wait((read_runtime_suspended_time(data->drm_fd) > prev_rpm) && (DC9_RESETS_DC_COUNTERS(data->devid) ?
> + (read_dc_counter(data->debugfs_fd, dc_target) < prev_dc) : true), msecs, 100);
The above condition would be more readable as:
rpm_time > prev_rpm &&
(!DC9_RESETS_DC_COUNTERS || dc_counter < prev_dc)
Probably better to change the 100 msec polling interval to 1 sec, to
account for what the sleep(1) you remove later was supposed to
achieve.
With the above changes:
Reviewed-by: Imre Deak <imre.deak@intel.com>
> }
>
> -static void check_dc9(data_t *data, int dc_target, int prev_dc)
> +static void check_dc9(data_t *data, int dc_target, int prev_dc, int prev_rpm)
> {
> - igt_assert_f(dc9_wait_entry(data->debugfs_fd, dc_target, prev_dc, 3000),
> + igt_assert_f(dc9_wait_entry(data, dc_target, prev_dc, prev_rpm, 3000),
> "DC9 state is not achieved\n%s:\n%s\n", RPM_STATUS,
> data->debugfs_dump = igt_sysfs_get(data->debugfs_fd, RPM_STATUS));
> }
>
> static void setup_dc9_dpms(data_t *data, int dc_target)
> {
> - int prev_dc, sysfs_fd;
> + int prev_dc, prev_rpm, sysfs_fd;
Let's init prev_dc to avoid passing it further as a random data (even if
it's not used).
> igt_require((sysfs_fd = open(KMS_HELPER, O_RDONLY)) >= 0);
> kms_poll_saved_state = igt_sysfs_get_boolean(sysfs_fd, "poll");
> igt_sysfs_set_boolean(sysfs_fd, "poll", KMS_POLL_DISABLE);
> close(sysfs_fd);
> - prev_dc = read_dc_counter(data->debugfs_fd, dc_target);
> - setup_dc_dpms(data);
> - dpms_off(data);
> - igt_skip_on_f(!(igt_wait(read_dc_counter(data->debugfs_fd, dc_target) >
> + if (DC9_RESETS_DC_COUNTERS(data->devid)) {
> + prev_dc = read_dc_counter(data->debugfs_fd, dc_target);
> + setup_dc_dpms(data);
> + dpms_off(data);
> + igt_skip_on_f(!(igt_wait(read_dc_counter(data->debugfs_fd, dc_target) >
> prev_dc, 3000, 100)), "Unable to enters shallow DC states\n");
> - prev_dc = read_dc_counter(data->debugfs_fd, dc_target);
> - dpms_on(data);
> - cleanup_dc_dpms(data);
> + prev_dc = read_dc_counter(data->debugfs_fd, dc_target);
> + dpms_on(data);
> + cleanup_dc_dpms(data);
> + }
> + prev_rpm = read_runtime_suspended_time(data->drm_fd);
> dpms_off(data);
> sleep(1); /* wait for counters reset*/
> - check_dc9(data, dc_target, prev_dc);
> + check_dc9(data, dc_target, prev_dc, prev_rpm);
> dpms_on(data);
> }
>
> --
> 2.25.1
>
next prev parent reply other threads:[~2022-09-12 13:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-09 11:49 [igt-dev] [PATCH i-g-t v6 0/5] Modify dc9 validation Swati Sharma
2022-09-09 11:49 ` [igt-dev] [PATCH i-g-t 1/5] tests/i915/i915_pm_dc: Add test description Swati Sharma
2022-09-12 13:04 ` Imre Deak
2022-09-09 11:49 ` [igt-dev] [PATCH i-g-t v3 2/5] tests/i915/i915_pm_dc: Change debugfs for reading platform info Swati Sharma
2022-09-09 11:49 ` [igt-dev] [PATCH i-g-t v4 3/5] lib/pm: Add helper functions to get runtime suspended time Swati Sharma
2022-09-09 11:49 ` [igt-dev] [PATCH i-g-t v5 4/5] tests/i915/i915_pm_dc: Modify dc9 test Swati Sharma
2022-09-12 13:23 ` Imre Deak [this message]
2022-09-09 11:49 ` [igt-dev] [PATCH i-g-t 5/5] tests/i915/i915_pm_dc: Sleep not reqd. to reset counter Swati Sharma
2022-09-12 13:23 ` Imre Deak
2022-09-09 13:20 ` [igt-dev] ✓ Fi.CI.BAT: success for Modify dc9 validation (rev6) Patchwork
2022-09-09 16:31 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=Yx8ytepV2brDMFSD@ideak-desk.fi.intel.com \
--to=imre.deak@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=swati2.sharma@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.