[Intel-gfx] [PATCH i-g-t 2/2] tests/drv_suspend: Add subtests to check that forcewake is kept after resume

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 25 15:44:06 UTC 2017


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 at intel.com>
> Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg at intel.com>
> Cc: Michal Winiarski <michal.winiarski at intel.com>
> Signed-off-by: Ewelina Musial <ewelina.musial at 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


More information about the Intel-gfx mailing list