* [PATCH i-g-t 1/2] igt: Move read_rc6_residency function to lib
@ 2017-07-25 15:26 Ewelina Musial
2017-07-25 15:26 ` [PATCH i-g-t 2/2] tests/drv_suspend: Add subtests to check that forcewake is kept after resume Ewelina Musial
2017-07-26 7:49 ` [PATCH i-g-t 1/2] igt: Move read_rc6_residency function to lib Szwichtenberg, Radoslaw
0 siblings, 2 replies; 4+ messages in thread
From: Ewelina Musial @ 2017-07-25 15:26 UTC (permalink / raw)
To: intel-gfx
Gem_mocs_settings and pm_rc6_residency tests are defining
the same functionality to read residency from sysfs.
Moving that function to lib/igt_aux and updating tests.
Signed-off-by: Ewelina Musial <ewelina.musial@intel.com>
---
lib/igt_aux.c | 8 ++++++++
lib/igt_aux.h | 5 +++++
tests/gem_mocs_settings.c | 10 ++--------
tests/pm_rc6_residency.c | 19 ++++---------------
4 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 86a213c2..224da4b6 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1680,3 +1680,11 @@ double igt_stop_siglatency(struct igt_mean *result)
return mean;
}
+
+uint32_t read_residency(int dir, const char *name)
+{
+ char path[128];
+
+ sprintf(path, "power/%s_residency_ms", name);
+ return igt_sysfs_get_u32(dir, path);
+}
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 499a1679..8cc06f8c 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -386,4 +386,9 @@ static inline bool igt_list_empty(const struct igt_list *list)
&pos->member != (head); \
pos = tmp, tmp = igt_list_next_entry(pos, member))
+/**
+ * Helper to read RC6 and MC6 residencies from sysfs
+ */
+uint32_t read_residency(int dir, const char *name);
+
#endif /* IGT_AUX_H */
diff --git a/tests/gem_mocs_settings.c b/tests/gem_mocs_settings.c
index 05dfc637..67a52f50 100644
--- a/tests/gem_mocs_settings.c
+++ b/tests/gem_mocs_settings.c
@@ -328,12 +328,6 @@ static void check_l3cc_registers(int fd,
gem_close(fd, dst_handle);
}
-
-static uint32_t rc6_residency(int dir)
-{
- return igt_sysfs_get_u32(dir, "power/rc6_residency_ms");
-}
-
static void rc6_wait(int fd)
{
int sysfs;
@@ -342,8 +336,8 @@ static void rc6_wait(int fd)
sysfs = igt_sysfs_open(fd, NULL);
igt_assert_lte(0, sysfs);
- residency = rc6_residency(sysfs);
- igt_require(igt_wait(rc6_residency(sysfs) != residency, 10000, 2));
+ residency = read_residency(sysfs, "rc6");
+ igt_require(igt_wait(read_residency(sysfs, "rc6") != residency, 10000, 2));
close(sysfs);
}
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index bdb9747a..ac6e019a 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -61,17 +61,6 @@ static unsigned long get_rc6_enabled_mask(void)
return rc6_mask;
}
-static unsigned long read_rc6_residency(const char *name)
-{
- unsigned long residency;
- char path[128];
-
- residency = 0;
- sprintf(path, "power/%s_residency_ms", name);
- igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
- return residency;
-}
-
static void residency_accuracy(unsigned int diff,
unsigned int duration,
const char *name_of_rc6_residency)
@@ -90,17 +79,17 @@ static void read_residencies(int devid, unsigned int rc6_mask,
struct residencies *res)
{
if (rc6_mask & RC6_ENABLED)
- res->rc6 = read_rc6_residency("rc6");
+ res->rc6 = read_residency(sysfs, "rc6");
if ((rc6_mask & RC6_ENABLED) &&
(IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)))
- res->media_rc6 = read_rc6_residency("media_rc6");
+ res->media_rc6 = read_residency(sysfs, "media_rc6");
if (rc6_mask & RC6P_ENABLED)
- res->rc6p = read_rc6_residency("rc6p");
+ res->rc6p = read_residency(sysfs, "rc6p");
if (rc6_mask & RC6PP_ENABLED)
- res->rc6pp = read_rc6_residency("rc6pp");
+ res->rc6pp = read_residency(sysfs, "rc6pp");
}
static unsigned long gettime_ms(void)
--
2.13.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH i-g-t 2/2] tests/drv_suspend: Add subtests to check that forcewake is kept after resume
2017-07-25 15:26 [PATCH i-g-t 1/2] igt: Move read_rc6_residency function to lib Ewelina Musial
@ 2017-07-25 15:26 ` Ewelina Musial
2017-07-25 15:44 ` Chris Wilson
2017-07-26 7:49 ` [PATCH i-g-t 1/2] igt: Move read_rc6_residency function to lib Szwichtenberg, Radoslaw
1 sibling, 1 reply; 4+ messages in thread
From: Ewelina Musial @ 2017-07-25 15:26 UTC (permalink / raw)
To: intel-gfx
In some cases we observed that forcewake isn't kept after
resume and checking RC6 residency is a simple way to verify that.
If forcewake is kept after resume residency should be constant.
Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>
Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Signed-off-by: Ewelina Musial <ewelina.musial@intel.com>
---
tests/drv_suspend.c | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c
index 2e39f20a..0c576055 100644
--- a/tests/drv_suspend.c
+++ b/tests/drv_suspend.c
@@ -36,6 +36,9 @@
#include <errno.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include "igt_sysfs.h"
+#include "igt_aux.h"
+#include <time.h>
#include <drm.h>
@@ -160,8 +163,9 @@ test_sysfs_reader(bool hibernate)
igt_stop_helper(&reader);
}
+#define SLEEP_DURATION 3
static void
-test_forcewake(int fd, bool hibernate)
+test_forcewake(int fd, bool hibernate, bool residency)
{
int fw_fd;
@@ -174,8 +178,26 @@ test_forcewake(int fd, bool hibernate)
else
igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
SUSPEND_TEST_NONE);
+ if (residency)
+ {
+ int sysfs;
+ uint32_t residency_pre, residency_post;
- close (fw_fd);
+ sysfs = igt_sysfs_open(fd, NULL);
+ igt_assert_lte(0, sysfs);
+ sleep(1); // time to fully resume
+
+ // forcewake should keep residency constant after resume
+ residency_pre = read_residency(sysfs, "rc6");
+ sleep(SLEEP_DURATION);
+ residency_post = read_residency(sysfs, "rc6");
+
+ igt_assert_eq(residency_pre, residency_post);
+
+ close(sysfs);
+ }
+
+ close (fw_fd);
}
int fd;
@@ -200,7 +222,10 @@ igt_main
test_sysfs_reader(false);
igt_subtest("forcewake")
- test_forcewake(fd, false);
+ test_forcewake(fd, false, false);
+
+ igt_subtest("rc6-forcewake")
+ test_forcewake(fd, false, true);
igt_subtest("fence-restore-tiled2untiled-hibernate")
test_fence_restore(fd, true, true);
@@ -215,7 +240,10 @@ igt_main
test_sysfs_reader(true);
igt_subtest("forcewake-hibernate")
- test_forcewake(fd, true);
+ test_forcewake(fd, true, false);
+
+ igt_subtest("rc6-forcewake-hibernate")
+ test_forcewake(fd, true, true);
igt_fixture
close(fd);
--
2.13.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH i-g-t 2/2] tests/drv_suspend: Add subtests to check that forcewake is kept after resume
2017-07-25 15:26 ` [PATCH i-g-t 2/2] tests/drv_suspend: Add subtests to check that forcewake is kept after resume Ewelina Musial
@ 2017-07-25 15:44 ` Chris Wilson
0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2017-07-25 15:44 UTC (permalink / raw)
To: Ewelina Musial, intel-gfx
Quoting Ewelina Musial (2017-07-25 16:26:09)
> In some cases we observed that forcewake isn't kept after
> resume and checking RC6 residency is a simple way to verify that.
> If forcewake is kept after resume residency should be constant.
>
> Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>
> Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> Signed-off-by: Ewelina Musial <ewelina.musial@intel.com>
> ---
> tests/drv_suspend.c | 36 ++++++++++++++++++++++++++++++++----
> 1 file changed, 32 insertions(+), 4 deletions(-)
>
> diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c
> index 2e39f20a..0c576055 100644
> --- a/tests/drv_suspend.c
> +++ b/tests/drv_suspend.c
> @@ -36,6 +36,9 @@
> #include <errno.h>
> #include <sys/stat.h>
> #include <sys/ioctl.h>
> +#include "igt_sysfs.h"
> +#include "igt_aux.h"
> +#include <time.h>
>
> #include <drm.h>
>
> @@ -160,8 +163,9 @@ test_sysfs_reader(bool hibernate)
> igt_stop_helper(&reader);
> }
>
> +#define SLEEP_DURATION 3
> static void
> -test_forcewake(int fd, bool hibernate)
> +test_forcewake(int fd, bool hibernate, bool residency)
> {
> int fw_fd;
>
> @@ -174,8 +178,26 @@ test_forcewake(int fd, bool hibernate)
> else
> igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> SUSPEND_TEST_NONE);
> + if (residency)
> + {
> + int sysfs;
> + uint32_t residency_pre, residency_post;
>
> - close (fw_fd);
> + sysfs = igt_sysfs_open(fd, NULL);
> + igt_assert_lte(0, sysfs);
> + sleep(1); // time to fully resume
rc6 is not universal, failing just because it is not supported after
suspending/hibernate does not make for happy users.
You have the power to add additional sanity checks to the kernel and
report the failure via close() without resorting to indirect checks and
fragile assumptions.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH i-g-t 1/2] igt: Move read_rc6_residency function to lib
2017-07-25 15:26 [PATCH i-g-t 1/2] igt: Move read_rc6_residency function to lib Ewelina Musial
2017-07-25 15:26 ` [PATCH i-g-t 2/2] tests/drv_suspend: Add subtests to check that forcewake is kept after resume Ewelina Musial
@ 2017-07-26 7:49 ` Szwichtenberg, Radoslaw
1 sibling, 0 replies; 4+ messages in thread
From: Szwichtenberg, Radoslaw @ 2017-07-26 7:49 UTC (permalink / raw)
To: intel-gfx@lists.freedesktop.org, Musial, Ewelina
On Tue, 2017-07-25 at 17:26 +0200, Ewelina Musial wrote:
> Gem_mocs_settings and pm_rc6_residency tests are defining
> the same functionality to read residency from sysfs.
> Moving that function to lib/igt_aux and updating tests.
>
> Signed-off-by: Ewelina Musial <ewelina.musial@intel.com>
Reviewed-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-07-26 7:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-25 15:26 [PATCH i-g-t 1/2] igt: Move read_rc6_residency function to lib Ewelina Musial
2017-07-25 15:26 ` [PATCH i-g-t 2/2] tests/drv_suspend: Add subtests to check that forcewake is kept after resume Ewelina Musial
2017-07-25 15:44 ` Chris Wilson
2017-07-26 7:49 ` [PATCH i-g-t 1/2] igt: Move read_rc6_residency function to lib Szwichtenberg, Radoslaw
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.