diff mbox series

[v3,i-g-t,14/15] tests/i915/i915_hangman: Configure engine properties for quicker hangs

Message ID 20220113195947.1536897-15-John.C.Harrison@Intel.com (mailing list archive)
State New, archived
Headers show
Series Fixes for i915_hangman and gem_exec_capture | expand

Commit Message

John Harrison Jan. 13, 2022, 7:59 p.m. UTC
From: John Harrison <John.C.Harrison@Intel.com>

Some platforms have very long timeouts configured for some engines.
Some have them disabled completely. That makes for a very slow (or
broken) hangman test. So explicitly configure the engines to have
reasonable settings first.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
---
 tests/i915/i915_hangman.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Matthew Brost Jan. 13, 2022, 10:38 p.m. UTC | #1
On Thu, Jan 13, 2022 at 11:59:46AM -0800, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
> 
> Some platforms have very long timeouts configured for some engines.
> Some have them disabled completely. That makes for a very slow (or
> broken) hangman test. So explicitly configure the engines to have
> reasonable settings first.
> 
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>  tests/i915/i915_hangman.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/tests/i915/i915_hangman.c b/tests/i915/i915_hangman.c
> index 567eb71ee..1a2b2cf7a 100644
> --- a/tests/i915/i915_hangman.c
> +++ b/tests/i915/i915_hangman.c
> @@ -500,8 +500,12 @@ igt_main
>  {
>  	const intel_ctx_t *ctx;
>  	igt_hang_t hang = {};
> +	struct gem_engine_properties saved_params[GEM_MAX_ENGINES];
> +	int num_engines = 0;
>  
>  	igt_fixture {
> +		const struct intel_execution_engine2 *e;
> +
>  		device = drm_open_driver(DRIVER_INTEL);
>  		igt_require_gem(device);
>  
> @@ -515,6 +519,13 @@ igt_main
>  		igt_require(has_error_state(sysfs));
>  
>  		gem_require_mmap_wc(device);
> +
> +		for_each_physical_engine(device, e) {
> +			saved_params[num_engines].engine = e;
> +			saved_params[num_engines].preempt_timeout = 500;
> +			saved_params[num_engines].heartbeat_interval = 1000;
> +			gem_engine_properties_configure(device, saved_params + num_engines++);
> +		}
>  	}
>  
>  	igt_describe("Basic error capture");
> @@ -546,6 +557,11 @@ igt_main
>  	do_tests("engine", "engine", ctx);
>  
>  	igt_fixture {
> +		int i;
> +
> +		for (i = 0; i < num_engines; i++)
> +			gem_engine_properties_restore(device, saved_params + i);

If you wanted to be clever:

while (num_engines--)
	gem_engine_properties_restore(device, saved_params + num_engines);

Regardless:
Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> +
>  		igt_disallow_hang(device, hang);
>  		intel_ctx_destroy(device, ctx);
>  		close(device);
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/tests/i915/i915_hangman.c b/tests/i915/i915_hangman.c
index 567eb71ee..1a2b2cf7a 100644
--- a/tests/i915/i915_hangman.c
+++ b/tests/i915/i915_hangman.c
@@ -500,8 +500,12 @@  igt_main
 {
 	const intel_ctx_t *ctx;
 	igt_hang_t hang = {};
+	struct gem_engine_properties saved_params[GEM_MAX_ENGINES];
+	int num_engines = 0;
 
 	igt_fixture {
+		const struct intel_execution_engine2 *e;
+
 		device = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(device);
 
@@ -515,6 +519,13 @@  igt_main
 		igt_require(has_error_state(sysfs));
 
 		gem_require_mmap_wc(device);
+
+		for_each_physical_engine(device, e) {
+			saved_params[num_engines].engine = e;
+			saved_params[num_engines].preempt_timeout = 500;
+			saved_params[num_engines].heartbeat_interval = 1000;
+			gem_engine_properties_configure(device, saved_params + num_engines++);
+		}
 	}
 
 	igt_describe("Basic error capture");
@@ -546,6 +557,11 @@  igt_main
 	do_tests("engine", "engine", ctx);
 
 	igt_fixture {
+		int i;
+
+		for (i = 0; i < num_engines; i++)
+			gem_engine_properties_restore(device, saved_params + i);
+
 		igt_disallow_hang(device, hang);
 		intel_ctx_destroy(device, ctx);
 		close(device);