On Tue, Aug 15, 2017 at 11:34:30AM +0100, Chris Wilson wrote:
> These tests do not tell the kernel they can use the upper 48bits of
> aperture space, and cause eviction on the low 4G just as effectively
> exercising the evict code.
> 
> Signed-off-by: Chris Wilson <[email protected]>
Reviewed-by: Arkadiusz Hiler <[email protected]>
> ---
>  tests/gem_evict_alignment.c  | 35 +++++++++++++++++++++++++++++------
>  tests/gem_evict_everything.c | 33 +++++++++++++++++++++++++++------
>  2 files changed, 56 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/gem_evict_alignment.c b/tests/gem_evict_alignment.c
> index a5dfd0d9..8e6180bb 100644
> --- a/tests/gem_evict_alignment.c
> +++ b/tests/gem_evict_alignment.c
> @@ -196,29 +196,46 @@ igt_main
>       igt_fixture {
>               fd = drm_open_driver(DRIVER_INTEL);
>               igt_require_gem(fd);
> +             igt_fork_hang_detector(fd);
>       }
>  
>       igt_subtest("minor-normal") {
>               size = 1024 * 1024;
> -             count = 3*gem_aperture_size(fd) / size / 4;
> +             count = gem_aperture_size(fd);
> +             if (count >> 32)
> +                     count = 1 << 32;
> +             count = 3 * count / size / 4;
>               minor_evictions(fd, size, count);
>       }
>  
>       igt_subtest("major-normal") {
> -             size = 3*gem_aperture_size(fd) / 4;
> +             size = gem_aperture_size(fd);
> +             if (size >> 32)
> +                     size = 1 << 32;
> +             size = 3 * size / 4;
>               count = 4;
>               major_evictions(fd, size, count);
>       }
>  
> +     igt_fixture {
> +             igt_stop_hang_detector();
> +     }
> +
>       igt_fork_signal_helper();
>       igt_subtest("minor-interruptible") {
>               size = 1024 * 1024;
> -             count = 3*gem_aperture_size(fd) / size / 4;
> +             count = gem_aperture_size(fd);
> +             if (count >> 32)
> +                     count = 1 << 32;
> +             count = 3 * count / size / 4;
>               minor_evictions(fd, size, count);
>       }
>  
>       igt_subtest("major-interruptible") {
> -             size = 3*gem_aperture_size(fd) / 4;
> +             size = gem_aperture_size(fd);
> +             if (size >> 32)
> +                     size = 1 << 32;
> +             size = 3 * size / 4;
>               count = 4;
>               major_evictions(fd, size, count);
>       }
> @@ -226,12 +243,18 @@ igt_main
>       igt_subtest("minor-hang") {
>               igt_fork_hang_helper();
>               size = 1024 * 1024;
> -             count = 3*gem_aperture_size(fd) / size / 4;
> +             count = gem_aperture_size(fd);
> +             if (count >> 32)
> +                     count = 1 << 32;
> +             count = 3 * count / size / 4;
>               minor_evictions(fd, size, count);
>       }
>  
>       igt_subtest("major-hang") {
> -             size = 3*gem_aperture_size(fd) / 4;
> +             size = gem_aperture_size(fd);
> +             if (size >> 32)
> +                     size = 1 << 32;
> +             size = 3 * size / 4;
>               count = 4;
>               major_evictions(fd, size, count);
>       }
> diff --git a/tests/gem_evict_everything.c b/tests/gem_evict_everything.c
> index 2f93cde1..6aec7c18 100644
> --- a/tests/gem_evict_everything.c
> +++ b/tests/gem_evict_everything.c
> @@ -185,7 +185,12 @@ igt_main
>               igt_require_gem(fd);
>  
>               size = 1024 * 1024;
> -             count = 3*gem_aperture_size(fd) / size / 4;
> +             count = gem_aperture_size(fd);
> +             if (count >> 32)
> +                     count = 1 << 32;
> +             count = 3 * count / size / 4;
> +
> +             igt_fork_hang_detector(fd);
>       }
>  
>       for (unsigned flags = 0; flags < ALL_FORKING_EVICTIONS + 1; flags++) {
> @@ -210,14 +215,20 @@ igt_main
>               test_minor_evictions(fd, size, count);
>  
>       igt_subtest("major-normal") {
> -             size = 3*gem_aperture_size(fd) / 4;
> +             size = gem_aperture_size(fd);
> +             if (size >> 32)
> +                     size = 1 << 32;
> +             size = 3 * size / 4;
>               count = 4;
>               test_major_evictions(fd, size, count);
>       }
>  
>       igt_fixture {
>               size = 1024 * 1024;
> -             count = 3*gem_aperture_size(fd) / size / 4;
> +             count = gem_aperture_size(fd);
> +             if (count >> 32)
> +                     count = 1 << 32;
> +             count = 3 * count / size / 4;
>       }
>  
>       igt_fork_signal_helper();
> @@ -232,16 +243,23 @@ igt_main
>               test_minor_evictions(fd, size, count);
>  
>       igt_subtest("major-interruptible") {
> -             size = 3*gem_aperture_size(fd) / 4;
> +             size = gem_aperture_size(fd);
> +             if (size >> 32)
> +                     size = 1 << 32;
> +             size = 3 * size / 4;
>               count = 4;
>               test_major_evictions(fd, size, count);
>       }
>  
>       igt_fixture {
> +             igt_stop_hang_detector();
>               igt_fork_hang_helper();
>  
>               size = 1024 * 1024;
> -             count = 3*gem_aperture_size(fd) / size / 4;
> +             count = gem_aperture_size(fd);
> +             if (count >> 32)
> +                     count = 1 << 32;
> +             count = 3 * count / size / 4;
>       }
>  
>       igt_subtest("mlocked-hang")
> @@ -254,7 +272,10 @@ igt_main
>               test_minor_evictions(fd, size, count);
>  
>       igt_subtest("major-hang") {
> -             size = 3*gem_aperture_size(fd) / 4;
> +             size = gem_aperture_size(fd);
> +             if (size >> 32)
> +                     size = 1 << 32;
> +             size = 3 * size / 4;
>               count = 4;
>               test_major_evictions(fd, size, count);
>       }
> -- 
> 2.13.3
> 
> _______________________________________________
> Intel-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to