Message ID | 20170725152609.16264-2-ewelina.musial@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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
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);
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(-)