[Intel-gfx] [PATCH i-g-t] igt/gem_fence_thrash, gem_mmap_gtt: Don't let the device sleep

Mika Kuoppala mika.kuoppala at linux.intel.com
Thu May 23 10:08:43 UTC 2019


Chris Wilson <chris at chris-wilson.co.uk> writes:

> These tests are not intended to exercise runtime pm, but the device
> going to sleep in the middle of these tests can significantly slow them
> down as the GTT mmapping is torn down and must be rebuilt. This can be a
> major nuisance if the device autosuspends many times a second.
>
> These tests differ from typical applications as they are not doing any
> rendering or utilizing the display which would ordinarily keep the
> device awake.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  tests/i915/gem_fence_thrash.c | 17 +++++++++++++++++
>  tests/i915/gem_mmap_gtt.c     | 15 ++++++++++++++-
>  2 files changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/tests/i915/gem_fence_thrash.c b/tests/i915/gem_fence_thrash.c
> index 2d7fb2ff8..770e9cb98 100644
> --- a/tests/i915/gem_fence_thrash.c
> +++ b/tests/i915/gem_fence_thrash.c
> @@ -232,10 +232,27 @@ static int run_test(int threads_per_fence, void *f, int tiling,
>  	return 0;
>  }
>  
> +static int wakeref_open(int device)
> +{
> +	int dir, fd;
> +
> +	dir = igt_debugfs_dir(device);
> +	fd = openat(dir, "i915_wakeref_user", O_RDONLY);

I was seeking the corresponding debugfs entry. However
it seems forcewake user takes the pm ref and you want to piggyback on
that.

also igt_assert(fd != -1) ?
-Mika

> +	close(dir);
> +
> +	return fd;
> +}
> +
>  igt_main
>  {
>  	igt_skip_on_simulation();
>  
> +	igt_fixture {
> +		int fd = drm_open_driver(DRIVER_INTEL);
> +		wakeref_open(fd);
> +		close(fd);
> +	}
> +
>  	igt_subtest("bo-write-verify-none")
>  		igt_assert(run_test(0, bo_write_verify, I915_TILING_NONE, 80) == 0);
>  
> diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
> index 9a670f030..4b709f81e 100644
> --- a/tests/i915/gem_mmap_gtt.c
> +++ b/tests/i915/gem_mmap_gtt.c
> @@ -873,6 +873,17 @@ static int mmap_ioctl(int i915, struct drm_i915_gem_mmap_gtt *arg)
>  	return err;
>  }
>  
> +static int wakeref_open(int device)
> +{
> +	int dir, fd;
> +
> +	dir = igt_debugfs_dir(device);
> +	fd = openat(dir, "i915_wakeref_user", O_RDONLY);
> +	close(dir);
> +
> +	return fd;
> +}
> +
>  int fd;
>  
>  igt_main
> @@ -880,8 +891,10 @@ igt_main
>  	if (igt_run_in_simulation())
>  		OBJECT_SIZE = 1 * 1024 * 1024;
>  
> -	igt_fixture
> +	igt_fixture {
>  		fd = drm_open_driver(DRIVER_INTEL);
> +		wakeref_open(fd);
> +	}
>  
>  	igt_subtest("bad-object") {
>  		uint32_t real_handle = gem_create(fd, 4096);
> -- 
> 2.20.1


More information about the Intel-gfx mailing list