[i-g-t,01/13] i915/gem_mocs_settings: Allow hangs around reset tests

Submitted by Chris Wilson on Feb. 4, 2019, 8:36 a.m.

Details

Message ID 20190204083614.2385-1-chris@chris-wilson.co.uk
State New
Series "Series without cover letter"
Headers show

Commit Message

Chris Wilson Feb. 4, 2019, 8:36 a.m.
To inject a GPU hang, we should ask the kernel first if it is legal to
do so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_mocs_settings.c | 54 +++++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 20 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/i915/gem_mocs_settings.c b/tests/i915/gem_mocs_settings.c
index 967223f1b..5b3b6bc1e 100644
--- a/tests/i915/gem_mocs_settings.c
+++ b/tests/i915/gem_mocs_settings.c
@@ -453,26 +453,40 @@  igt_main
 			continue;
 
 		for (unsigned mode = NONE; mode < MAX_MOCS_TEST_MODES; mode++) {
-			for (unsigned flags = 0; flags < ALL_MOCS_FLAGS + 1; flags++) {
-				/* Trying to test non-render engines for dirtying MOCS
-				 * values from one context having effect on different
-				 * context is bound to fail - only render engine is
-				 * doing context save/restore of MOCS registers.
-				 * Let's also limit testing values on non-default
-				 * contexts to render-only.
-				 */
-				if (flags && e->exec_id != I915_EXEC_RENDER)
-					continue;
-
-				igt_subtest_f("mocs-%s%s%s-%s",
-					      test_modes[mode],
-					      flags & MOCS_NON_DEFAULT_CTX ? "-ctx": "",
-					      flags & MOCS_DIRTY_VALUES ? "-dirty" : "",
-					      e->name) {
-					if (flags & (MOCS_NON_DEFAULT_CTX | MOCS_DIRTY_VALUES))
-						gem_require_contexts(fd);
-
-					run_test(fd, e->exec_id | e->flags, flags, mode);
+			igt_subtest_group {
+				igt_hang_t hang = {};
+
+				igt_fixture {
+					if (mode == RESET)
+						hang = igt_allow_hang(fd, 0, 0);
+				}
+
+				for (unsigned flags = 0; flags < ALL_MOCS_FLAGS + 1; flags++) {
+					/* Trying to test non-render engines for dirtying MOCS
+					 * values from one context having effect on different
+					 * context is bound to fail - only render engine is
+					 * doing context save/restore of MOCS registers.
+					 * Let's also limit testing values on non-default
+					 * contexts to render-only.
+					 */
+					if (flags && e->exec_id != I915_EXEC_RENDER)
+						continue;
+
+					igt_subtest_f("mocs-%s%s%s-%s",
+						      test_modes[mode],
+						      flags & MOCS_NON_DEFAULT_CTX ? "-ctx": "",
+						      flags & MOCS_DIRTY_VALUES ? "-dirty" : "",
+						      e->name) {
+						if (flags & (MOCS_NON_DEFAULT_CTX | MOCS_DIRTY_VALUES))
+							gem_require_contexts(fd);
+
+						run_test(fd, e->exec_id | e->flags, flags, mode);
+					}
+				}
+
+				igt_fixture {
+					if (mode == RESET)
+						igt_disallow_hang(fd, hang);
 				}
 			}
 		}

Comments

Tvrtko Ursulin Feb. 4, 2019, 9:16 a.m.
On 04/02/2019 08:36, Chris Wilson wrote:
> To inject a GPU hang, we should ask the kernel first if it is legal to
> do so.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   tests/i915/gem_mocs_settings.c | 54 +++++++++++++++++++++-------------
>   1 file changed, 34 insertions(+), 20 deletions(-)
> 
> diff --git a/tests/i915/gem_mocs_settings.c b/tests/i915/gem_mocs_settings.c
> index 967223f1b..5b3b6bc1e 100644
> --- a/tests/i915/gem_mocs_settings.c
> +++ b/tests/i915/gem_mocs_settings.c
> @@ -453,26 +453,40 @@ igt_main
>   			continue;
>   
>   		for (unsigned mode = NONE; mode < MAX_MOCS_TEST_MODES; mode++) {
> -			for (unsigned flags = 0; flags < ALL_MOCS_FLAGS + 1; flags++) {
> -				/* Trying to test non-render engines for dirtying MOCS
> -				 * values from one context having effect on different
> -				 * context is bound to fail - only render engine is
> -				 * doing context save/restore of MOCS registers.
> -				 * Let's also limit testing values on non-default
> -				 * contexts to render-only.
> -				 */
> -				if (flags && e->exec_id != I915_EXEC_RENDER)
> -					continue;
> -
> -				igt_subtest_f("mocs-%s%s%s-%s",
> -					      test_modes[mode],
> -					      flags & MOCS_NON_DEFAULT_CTX ? "-ctx": "",
> -					      flags & MOCS_DIRTY_VALUES ? "-dirty" : "",
> -					      e->name) {
> -					if (flags & (MOCS_NON_DEFAULT_CTX | MOCS_DIRTY_VALUES))
> -						gem_require_contexts(fd);
> -
> -					run_test(fd, e->exec_id | e->flags, flags, mode);
> +			igt_subtest_group {
> +				igt_hang_t hang = {};
> +
> +				igt_fixture {
> +					if (mode == RESET)
> +						hang = igt_allow_hang(fd, 0, 0);
> +				}
> +
> +				for (unsigned flags = 0; flags < ALL_MOCS_FLAGS + 1; flags++) {
> +					/* Trying to test non-render engines for dirtying MOCS
> +					 * values from one context having effect on different
> +					 * context is bound to fail - only render engine is
> +					 * doing context save/restore of MOCS registers.
> +					 * Let's also limit testing values on non-default
> +					 * contexts to render-only.
> +					 */
> +					if (flags && e->exec_id != I915_EXEC_RENDER)
> +						continue;
> +
> +					igt_subtest_f("mocs-%s%s%s-%s",
> +						      test_modes[mode],
> +						      flags & MOCS_NON_DEFAULT_CTX ? "-ctx": "",
> +						      flags & MOCS_DIRTY_VALUES ? "-dirty" : "",
> +						      e->name) {
> +						if (flags & (MOCS_NON_DEFAULT_CTX | MOCS_DIRTY_VALUES))
> +							gem_require_contexts(fd);
> +
> +						run_test(fd, e->exec_id | e->flags, flags, mode);
> +					}
> +				}
> +
> +				igt_fixture {
> +					if (mode == RESET)
> +						igt_disallow_hang(fd, hang);
>   				}
>   			}
>   		}
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
Katarzyna Dec Feb. 4, 2019, 9:31 a.m.
On Mon, Feb 04, 2019 at 08:36:02AM +0000, Chris Wilson wrote:
> To inject a GPU hang, we should ask the kernel first if it is legal to
> do so.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>

Kasia :)