diff mbox

[igt] igt/gem_evict_(alignment, everything): Limit to low 4G

Message ID 20170815103430.2784-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Aug. 15, 2017, 10:34 a.m. UTC
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 <chris@chris-wilson.co.uk>
---
 tests/gem_evict_alignment.c  | 35 +++++++++++++++++++++++++++++------
 tests/gem_evict_everything.c | 33 +++++++++++++++++++++++++++------
 2 files changed, 56 insertions(+), 12 deletions(-)

Comments

Chris Wilson Sept. 7, 2017, 6:15 p.m. UTC | #1
Quoting Chris Wilson (2017-08-15 11:34:30)
> 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 <chris@chris-wilson.co.uk>

* Crickets.

> ---
>  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
>
Arkadiusz Hiler Sept. 8, 2017, 9:07 a.m. UTC | #2
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 <chris@chris-wilson.co.uk>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
>  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
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

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);
 	}