From: "Gupta, Anshuman" <anshuman.gupta@intel.com>
To: "Tauro, Riana" <riana.tauro@intel.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t v5 1/3] lib/igt_aux: add library function to read current selected state of mem_sleep
Date: Thu, 12 May 2022 10:39:41 +0000 [thread overview]
Message-ID: <11e3e2ff4d1c4614974636d1c96f9a0c@intel.com> (raw)
In-Reply-To: <20220512053427.2754986-2-riana.tauro@intel.com>
> -----Original Message-----
> From: Tauro, Riana <riana.tauro@intel.com>
> Sent: Thursday, May 12, 2022 11:04 AM
> To: igt-dev@lists.freedesktop.org
> Cc: Tauro, Riana <riana.tauro@intel.com>; Gupta, Anshuman
> <anshuman.gupta@intel.com>
> Subject: [PATCH i-g-t v5 1/3] lib/igt_aux: add library function to read current
> selected state of mem_sleep
>
> From: "Tauro, Riana" <riana.tauro@intel.com>
>
> Add a library function to read the current state of mem_sleep Used by suspend
> tests without i915 to skip s3 cycle, if platform has default state as s2idle.
> Reduces CI Execution time
>
> v2: Addressed cosmetic review comments (Anshuman)
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
>
> Signed-off-by: Tauro, Riana <riana.tauro@intel.com>
> ---
> lib/igt_aux.c | 52
> +++++++++++++++++++++++++++++++++++++++++++++++++++
> lib/igt_aux.h | 19 +++++++++++++++++++
> 2 files changed, 71 insertions(+)
>
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 03cc38c9..3945bebe 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -710,6 +710,12 @@ static const char *suspend_test_name[] = {
> [SUSPEND_TEST_CORE] = "core",
> };
>
> +static const char *mem_sleep_name[] = {
> + [MEM_SLEEP_FREEZE] = "s2idle",
> + [MEM_SLEEP_STANDBY] = "shallow",
> + [MEM_SLEEP_MEM] = "deep"
> +};
> +
> static enum igt_suspend_test get_suspend_test(int power_dir) {
> char *test_line;
> @@ -951,6 +957,52 @@ int igt_get_autoresume_delay(enum
> igt_suspend_state state)
> return delay;
> }
>
> +/**
> + * igt_get_memsleep_state
> + *
> + * Reads the value of /sys/power/mem_sleep and
> + * returns the current suspend state associated with 'mem'.
> + *
> + * Returns : an #igt_mem_sleep state, current suspend state associated with
> 'mem'.
> + */
> +int igt_get_memsleep_state(void)
> +{
> + char *mem_sleep_states;
> + char *mem_sleep_state;
> + enum igt_mem_sleep mem_sleep;
> + int power_dir;
> +
> + igt_require((power_dir = open("/sys/power", O_RDONLY)) >= 0);
> +
> + if (faccessat(power_dir, "mem_sleep", R_OK, 0))
> + return MEM_SLEEP_NONE;
> +
> + igt_assert((mem_sleep_states = igt_sysfs_get(power_dir,
> "mem_sleep")));
> + for (mem_sleep_state = strtok(mem_sleep_states, " ");
> mem_sleep_state;
> + mem_sleep_state = strtok(NULL, " ")) {
> + if (mem_sleep_state[0] == '[') {
> + mem_sleep_state[strlen(mem_sleep_state) - 1] = '\0';
> + mem_sleep_state++;
> + break;
> + }
> + }
> +
> + if (!mem_sleep_state) {
> + free(mem_sleep_states);
> + return MEM_SLEEP_NONE;
> + }
> +
> + for (mem_sleep = MEM_SLEEP_FREEZE; mem_sleep <
> MEM_SLEEP_NUM; mem_sleep++) {
> + if (strcmp(mem_sleep_name[mem_sleep], mem_sleep_state)
> == 0)
> + break;
> + }
> +
> + igt_assert_f(mem_sleep < MEM_SLEEP_NUM, "Invalid mem_sleep
> state\n");
> +
> + free(mem_sleep_states);
> + close(power_dir);
> + return mem_sleep;
> +}
> /**
> * igt_drop_root:
> *
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h index 9f2588ae..2f7efd9c 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -186,11 +186,30 @@ enum igt_suspend_test {
> SUSPEND_TEST_NUM,
> };
>
> +/**
> + * igt_mem_sleep:
> + * @MEM_SLEEP_NONE: no support
> + * @MEM_SLEEP_FREEZE: suspend-to-idle target state, aka S0ix or freeze,
> + * @MEM_SLEEP_STANDBY: standby target state, aka S1
> + * @MEM_SLEEP_MEM: suspend-to-mem target state aka S3 */ enum
> +igt_mem_sleep {
> + MEM_SLEEP_NONE,
> + MEM_SLEEP_FREEZE,
> + MEM_SLEEP_STANDBY,
> + MEM_SLEEP_MEM,
> +
> + /*<private>*/
> + MEM_SLEEP_NUM,
> +};
> +
> void igt_system_suspend_autoresume(enum igt_suspend_state state,
> enum igt_suspend_test test);
> void igt_set_autoresume_delay(int delay_secs); int
> igt_get_autoresume_delay(enum igt_suspend_state state);
>
> +int igt_get_memsleep_state(void);
> +
> /* dropping priviledges */
> void igt_drop_root(void);
>
> --
> 2.25.1
next prev parent reply other threads:[~2022-05-12 10:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-12 5:34 [igt-dev] [PATCH i-g-t v5 0/3] Extend system-suspend-without-i915 Riana Tauro
2022-05-12 5:34 ` [igt-dev] [PATCH i-g-t v5 1/3] lib/igt_aux: add library function to read current selected state of mem_sleep Riana Tauro
2022-05-12 10:39 ` Gupta, Anshuman [this message]
2022-05-12 5:34 ` [igt-dev] [PATCH i-g-t v5 2/3] tests/i915/i915_suspend: Add s2idle and s3 subtests without i915 Riana Tauro
2022-05-12 10:37 ` Gupta, Anshuman
2022-05-12 5:34 ` [igt-dev] [PATCH i-g-t v5 3/3] tests/intel-ci/fast-feedback: Add suspend tests without i915 to fast-feedback list Riana Tauro
2022-05-12 5:50 ` [igt-dev] ✗ GitLab.Pipeline: warning for Extend system-suspend-without-i915 (rev6) Patchwork
2022-05-12 6:15 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2022-05-13 5:41 ` Tauro, Riana
2022-05-13 15:47 ` Vudum, Lakshminarayana
2022-05-12 14:00 ` [igt-dev] ✗ Fi.CI.BAT: failure for Extend system-suspend-without-i915 (rev7) Patchwork
2022-05-13 15:23 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-05-13 15:25 ` Patchwork
2022-05-13 18:04 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-05-16 5:14 ` Tauro, Riana
2022-05-16 6:33 ` Vudum, Lakshminarayana
2022-05-16 6:14 ` [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=11e3e2ff4d1c4614974636d1c96f9a0c@intel.com \
--to=anshuman.gupta@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=riana.tauro@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.