All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v6 0/3] Extend system-suspend-without-i915
@ 2022-05-16  7:44 Riana Tauro
  2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 1/3] lib/igt_aux: add library function to read current selected state of mem_sleep Riana Tauro
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Riana Tauro @ 2022-05-16  7:44 UTC (permalink / raw)
  To: igt-dev

Add basic-s2idle-without-i915 and basic-s3-without-i915 to test 
s2idle and s3 cycles without i915 module.

These tests will be part of CI fast-feedback test list

Rev2: Add subtests for s2idle and s3 (Anshuman)
Rev3, Rev4 : rebase
Rev5: Optimized test to reduce CI Execution time (Anshuman)
Rev6: Addressed cosmetic review comments

Riana Tauro (3):
  lib/igt_aux: add library function to read current selected state of
    mem_sleep
  tests/i915/i915_suspend: Add s2idle and s3 subtests without i915
  tests/intel-ci/fast-feedback: Add suspend tests without i915 to
    fast-feedback list

 lib/igt_aux.c                         | 52 +++++++++++++++++++++++++++
 lib/igt_aux.h                         | 19 ++++++++++
 tests/i915/i915_suspend.c             | 16 ++++++---
 tests/intel-ci/fast-feedback.testlist |  3 +-
 4 files changed, 84 insertions(+), 6 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t v6 1/3] lib/igt_aux: add library function to read current selected state of mem_sleep
  2022-05-16  7:44 [igt-dev] [PATCH i-g-t v6 0/3] Extend system-suspend-without-i915 Riana Tauro
@ 2022-05-16  7:44 ` Riana Tauro
  2022-05-16 11:37   ` [igt-dev] [PATCH i-g-t v7 2/3] tests/i915/i915_suspend: Add s2idle and s3 subtests without i915 Riana Tauro
  2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 " Riana Tauro
  2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 3/3] tests/intel-ci/fast-feedback: Add suspend tests without i915 to fast-feedback list Riana Tauro
  2 siblings, 1 reply; 7+ messages in thread
From: Riana Tauro @ 2022-05-16  7:44 UTC (permalink / raw)
  To: igt-dev

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: Riana Tauro <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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t v6 2/3] tests/i915/i915_suspend: Add s2idle and s3 subtests without i915
  2022-05-16  7:44 [igt-dev] [PATCH i-g-t v6 0/3] Extend system-suspend-without-i915 Riana Tauro
  2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 1/3] lib/igt_aux: add library function to read current selected state of mem_sleep Riana Tauro
@ 2022-05-16  7:44 ` Riana Tauro
  2022-05-16 10:31   ` Petri Latvala
  2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 3/3] tests/intel-ci/fast-feedback: Add suspend tests without i915 to fast-feedback list Riana Tauro
  2 siblings, 1 reply; 7+ messages in thread
From: Riana Tauro @ 2022-05-16  7:44 UTC (permalink / raw)
  To: igt-dev

Add new tests basic-s2idle-without-i915 and basic-s3-without-i915
to exercise s2idle and s3 cycles to know the system wide
health of suspend/resume

v2: rebase
v3: rebase
v4: skip s3 when platform default state is s2idle to reduce
    CI time (Anshuman)

Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
---
 tests/i915/i915_suspend.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
index d34b7a5d..cb33d83e 100644
--- a/tests/i915/i915_suspend.c
+++ b/tests/i915/i915_suspend.c
@@ -204,12 +204,14 @@ test_forcewake(int fd, bool hibernate)
 }
 
 static void
-test_suspend_without_i915(void)
+test_suspend_without_i915(int state)
 {
 	igt_kmsg(KMSG_INFO "Unloading i915\n");
 	igt_assert_eq(igt_i915_driver_unload(),0);
 
-	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+	igt_skip_on_f(igt_get_memsleep_state() == MEM_SLEEP_FREEZE && state > SUSPEND_STATE_FREEZE,
+		      "Platform default state is s2idle\n");
+	igt_system_suspend_autoresume(state, SUSPEND_TEST_NONE);
 
 	igt_kmsg(KMSG_INFO "Re-loading i915 \n");
 	igt_assert_eq(igt_i915_driver_load(NULL), 0);
@@ -219,9 +221,13 @@ int fd;
 
 igt_main
 {
-	igt_describe("Validate system suspend cycle without i915 module");
-	igt_subtest("system-suspend-without-i915")
-		test_suspend_without_i915();
+	igt_describe("Validate suspend-to-idle without i915 module");
+	igt_subtest("basic-s2idle-without-i915")
+		test_suspend_without_i915(SUSPEND_STATE_FREEZE);
+
+	igt_describe("Validate S3 without i915 module");
+	igt_subtest("basic-s3-without-i915")
+		test_suspend_without_i915(SUSPEND_STATE_MEM);
 
 	igt_fixture
 		fd = drm_open_driver(DRIVER_INTEL);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t v6 3/3] tests/intel-ci/fast-feedback: Add suspend tests without i915 to fast-feedback list
  2022-05-16  7:44 [igt-dev] [PATCH i-g-t v6 0/3] Extend system-suspend-without-i915 Riana Tauro
  2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 1/3] lib/igt_aux: add library function to read current selected state of mem_sleep Riana Tauro
  2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 " Riana Tauro
@ 2022-05-16  7:44 ` Riana Tauro
  2 siblings, 0 replies; 7+ messages in thread
From: Riana Tauro @ 2022-05-16  7:44 UTC (permalink / raw)
  To: igt-dev

Add basic-s2idle-without-i915 and basic-s3-without-i915
to fast-feedback list.

v2: rebase
v3: rebase

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
Acked-by: Petri Latvala <petri.latvala@intel.com>
---
 tests/intel-ci/fast-feedback.testlist | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index d075aa31..b579c20a 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -176,7 +176,8 @@ igt@i915_selftest@live
 igt@dmabuf@all
 
 # System wide suspend tests
-igt@i915_suspend@system-suspend-without-i915
+igt@i915_suspend@basic-s2idle-without-i915
+igt@i915_suspend@basic-s3-without-i915
 igt@gem_exec_suspend@basic-s0
 igt@gem_exec_suspend@basic-s3
 igt@kms_chamelium@common-hpd-after-suspend
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v6 2/3] tests/i915/i915_suspend: Add s2idle and s3 subtests without i915
  2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 " Riana Tauro
@ 2022-05-16 10:31   ` Petri Latvala
  0 siblings, 0 replies; 7+ messages in thread
From: Petri Latvala @ 2022-05-16 10:31 UTC (permalink / raw)
  To: Riana Tauro; +Cc: igt-dev

On Mon, May 16, 2022 at 01:14:16PM +0530, Riana Tauro wrote:
> Add new tests basic-s2idle-without-i915 and basic-s3-without-i915
> to exercise s2idle and s3 cycles to know the system wide
> health of suspend/resume
> 
> v2: rebase
> v3: rebase
> v4: skip s3 when platform default state is s2idle to reduce
>     CI time (Anshuman)
> 
> Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
> ---
>  tests/i915/i915_suspend.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
> index d34b7a5d..cb33d83e 100644
> --- a/tests/i915/i915_suspend.c
> +++ b/tests/i915/i915_suspend.c
> @@ -204,12 +204,14 @@ test_forcewake(int fd, bool hibernate)
>  }
>  
>  static void
> -test_suspend_without_i915(void)
> +test_suspend_without_i915(int state)
>  {
>  	igt_kmsg(KMSG_INFO "Unloading i915\n");
>  	igt_assert_eq(igt_i915_driver_unload(),0);
>  
> -	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
> +	igt_skip_on_f(igt_get_memsleep_state() == MEM_SLEEP_FREEZE && state > SUSPEND_STATE_FREEZE,
> +		      "Platform default state is s2idle\n");

This message will appear alone in the result logs and might be hard to
understand. Expand the text a bit, "Platform default mem sleep state"
or something.


-- 
Petri Latvala


> +	igt_system_suspend_autoresume(state, SUSPEND_TEST_NONE);
>  
>  	igt_kmsg(KMSG_INFO "Re-loading i915 \n");
>  	igt_assert_eq(igt_i915_driver_load(NULL), 0);
> @@ -219,9 +221,13 @@ int fd;
>  
>  igt_main
>  {
> -	igt_describe("Validate system suspend cycle without i915 module");
> -	igt_subtest("system-suspend-without-i915")
> -		test_suspend_without_i915();
> +	igt_describe("Validate suspend-to-idle without i915 module");
> +	igt_subtest("basic-s2idle-without-i915")
> +		test_suspend_without_i915(SUSPEND_STATE_FREEZE);
> +
> +	igt_describe("Validate S3 without i915 module");
> +	igt_subtest("basic-s3-without-i915")
> +		test_suspend_without_i915(SUSPEND_STATE_MEM);
>  
>  	igt_fixture
>  		fd = drm_open_driver(DRIVER_INTEL);
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t v7 2/3] tests/i915/i915_suspend: Add s2idle and s3 subtests without i915
  2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 1/3] lib/igt_aux: add library function to read current selected state of mem_sleep Riana Tauro
@ 2022-05-16 11:37   ` Riana Tauro
  0 siblings, 0 replies; 7+ messages in thread
From: Riana Tauro @ 2022-05-16 11:37 UTC (permalink / raw)
  To: igt-dev; +Cc: petri.latvala

Add new tests basic-s2idle-without-i915 and basic-s3-without-i915
to exercise s2idle and s3 cycles to know the system wide
health of suspend/resume

v2: rebase
v3: rebase
v4: skip s3 when platform default state is s2idle to reduce
    CI time (Anshuman)
v5: modified the log message (Petri)

Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
---
 tests/i915/i915_suspend.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
index d34b7a5d..1c464f7a 100644
--- a/tests/i915/i915_suspend.c
+++ b/tests/i915/i915_suspend.c
@@ -204,12 +204,14 @@ test_forcewake(int fd, bool hibernate)
 }
 
 static void
-test_suspend_without_i915(void)
+test_suspend_without_i915(int state)
 {
 	igt_kmsg(KMSG_INFO "Unloading i915\n");
 	igt_assert_eq(igt_i915_driver_unload(),0);
 
-	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+	igt_skip_on_f(igt_get_memsleep_state() == MEM_SLEEP_FREEZE && state > SUSPEND_STATE_FREEZE,
+		      "Platform default mem_sleep state is s2idle\n");
+	igt_system_suspend_autoresume(state, SUSPEND_TEST_NONE);
 
 	igt_kmsg(KMSG_INFO "Re-loading i915 \n");
 	igt_assert_eq(igt_i915_driver_load(NULL), 0);
@@ -219,9 +221,13 @@ int fd;
 
 igt_main
 {
-	igt_describe("Validate system suspend cycle without i915 module");
-	igt_subtest("system-suspend-without-i915")
-		test_suspend_without_i915();
+	igt_describe("Validate suspend-to-idle without i915 module");
+	igt_subtest("basic-s2idle-without-i915")
+		test_suspend_without_i915(SUSPEND_STATE_FREEZE);
+
+	igt_describe("Validate S3 without i915 module");
+	igt_subtest("basic-s3-without-i915")
+		test_suspend_without_i915(SUSPEND_STATE_MEM);
 
 	igt_fixture
 		fd = drm_open_driver(DRIVER_INTEL);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t v7 2/3] tests/i915/i915_suspend: Add s2idle and s3 subtests without i915
  2022-05-16 11:43 [igt-dev] [PATCH i-g-t v7 0/3] Extend system-suspend-without-i915 Riana Tauro
@ 2022-05-16 11:43 ` Riana Tauro
  0 siblings, 0 replies; 7+ messages in thread
From: Riana Tauro @ 2022-05-16 11:43 UTC (permalink / raw)
  To: igt-dev; +Cc: petri.latvala

Add new tests basic-s2idle-without-i915 and basic-s3-without-i915
to exercise s2idle and s3 cycles to know the system wide
health of suspend/resume

v2: rebase
v3: rebase
v4: skip s3 when platform default state is s2idle to reduce
    CI time (Anshuman)
v5: modified the log message (Petri)

Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
---
 tests/i915/i915_suspend.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
index d34b7a5d..1c464f7a 100644
--- a/tests/i915/i915_suspend.c
+++ b/tests/i915/i915_suspend.c
@@ -204,12 +204,14 @@ test_forcewake(int fd, bool hibernate)
 }
 
 static void
-test_suspend_without_i915(void)
+test_suspend_without_i915(int state)
 {
 	igt_kmsg(KMSG_INFO "Unloading i915\n");
 	igt_assert_eq(igt_i915_driver_unload(),0);
 
-	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+	igt_skip_on_f(igt_get_memsleep_state() == MEM_SLEEP_FREEZE && state > SUSPEND_STATE_FREEZE,
+		      "Platform default mem_sleep state is s2idle\n");
+	igt_system_suspend_autoresume(state, SUSPEND_TEST_NONE);
 
 	igt_kmsg(KMSG_INFO "Re-loading i915 \n");
 	igt_assert_eq(igt_i915_driver_load(NULL), 0);
@@ -219,9 +221,13 @@ int fd;
 
 igt_main
 {
-	igt_describe("Validate system suspend cycle without i915 module");
-	igt_subtest("system-suspend-without-i915")
-		test_suspend_without_i915();
+	igt_describe("Validate suspend-to-idle without i915 module");
+	igt_subtest("basic-s2idle-without-i915")
+		test_suspend_without_i915(SUSPEND_STATE_FREEZE);
+
+	igt_describe("Validate S3 without i915 module");
+	igt_subtest("basic-s3-without-i915")
+		test_suspend_without_i915(SUSPEND_STATE_MEM);
 
 	igt_fixture
 		fd = drm_open_driver(DRIVER_INTEL);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-16 11:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  7:44 [igt-dev] [PATCH i-g-t v6 0/3] Extend system-suspend-without-i915 Riana Tauro
2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 1/3] lib/igt_aux: add library function to read current selected state of mem_sleep Riana Tauro
2022-05-16 11:37   ` [igt-dev] [PATCH i-g-t v7 2/3] tests/i915/i915_suspend: Add s2idle and s3 subtests without i915 Riana Tauro
2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 " Riana Tauro
2022-05-16 10:31   ` Petri Latvala
2022-05-16  7:44 ` [igt-dev] [PATCH i-g-t v6 3/3] tests/intel-ci/fast-feedback: Add suspend tests without i915 to fast-feedback list Riana Tauro
2022-05-16 11:43 [igt-dev] [PATCH i-g-t v7 0/3] Extend system-suspend-without-i915 Riana Tauro
2022-05-16 11:43 ` [igt-dev] [PATCH i-g-t v7 2/3] tests/i915/i915_suspend: Add s2idle and s3 subtests without i915 Riana Tauro

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.