diff mbox series

[v6,2/3] drm/i915/selftests: use live_subtests for live_migrate

Message ID 20221202122844.428006-2-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series [v6,1/3] drm/i915/migrate: Account for the reserved_space | expand

Commit Message

Matthew Auld Dec. 2, 2022, 12:28 p.m. UTC
Probably a good idea to do an igt_flush_test() at the end of each
subtest, just to be sure the previous work has been flushed and doesn't
somehow interfere with the current subtest.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Chris Wilson <chris.p.wilson@intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/i915/gt/selftest_migrate.c | 28 ++++++++++++++++------
 1 file changed, 21 insertions(+), 7 deletions(-)

Comments

Andrzej Hajda Dec. 6, 2022, 1:14 p.m. UTC | #1
On 02.12.2022 13:28, Matthew Auld wrote:
> Probably a good idea to do an igt_flush_test() at the end of each
> subtest, just to be sure the previous work has been flushed and doesn't
> somehow interfere with the current subtest.
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Chris Wilson <chris.p.wilson@intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Cc: Nirmoy Das <nirmoy.das@intel.com>

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

> ---
>   drivers/gpu/drm/i915/gt/selftest_migrate.c | 28 ++++++++++++++++------
>   1 file changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/selftest_migrate.c b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> index 0dc5309c90a4..1eab025ac002 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_migrate.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> @@ -486,7 +486,8 @@ global_clear(struct intel_migrate *migrate, u32 sz, struct rnd_state *prng)
>   
>   static int live_migrate_copy(void *arg)
>   {
> -	struct intel_migrate *migrate = arg;
> +	struct intel_gt *gt = arg;
> +	struct intel_migrate *migrate = &gt->migrate;
>   	struct drm_i915_private *i915 = migrate->context->engine->i915;
>   	I915_RND_STATE(prng);
>   	int i;
> @@ -507,7 +508,8 @@ static int live_migrate_copy(void *arg)
>   
>   static int live_migrate_clear(void *arg)
>   {
> -	struct intel_migrate *migrate = arg;
> +	struct intel_gt *gt = arg;
> +	struct intel_migrate *migrate = &gt->migrate;
>   	struct drm_i915_private *i915 = migrate->context->engine->i915;
>   	I915_RND_STATE(prng);
>   	int i;
> @@ -593,7 +595,10 @@ static int __thread_migrate_copy(void *arg)
>   
>   static int thread_migrate_copy(void *arg)
>   {
> -	return threaded_migrate(arg, __thread_migrate_copy, 0);
> +	struct intel_gt *gt = arg;
> +	struct intel_migrate *migrate = &gt->migrate;
> +
> +	return threaded_migrate(migrate, __thread_migrate_copy, 0);
>   }
>   
>   static int __thread_global_copy(void *arg)
> @@ -605,7 +610,10 @@ static int __thread_global_copy(void *arg)
>   
>   static int thread_global_copy(void *arg)
>   {
> -	return threaded_migrate(arg, __thread_global_copy, 0);
> +	struct intel_gt *gt = arg;
> +	struct intel_migrate *migrate = &gt->migrate;
> +
> +	return threaded_migrate(migrate, __thread_global_copy, 0);
>   }
>   
>   static int __thread_migrate_clear(void *arg)
> @@ -624,12 +632,18 @@ static int __thread_global_clear(void *arg)
>   
>   static int thread_migrate_clear(void *arg)
>   {
> -	return threaded_migrate(arg, __thread_migrate_clear, 0);
> +	struct intel_gt *gt = arg;
> +	struct intel_migrate *migrate = &gt->migrate;
> +
> +	return threaded_migrate(migrate, __thread_migrate_clear, 0);
>   }
>   
>   static int thread_global_clear(void *arg)
>   {
> -	return threaded_migrate(arg, __thread_global_clear, 0);
> +	struct intel_gt *gt = arg;
> +	struct intel_migrate *migrate = &gt->migrate;
> +
> +	return threaded_migrate(migrate, __thread_global_clear, 0);
>   }
>   
>   int intel_migrate_live_selftests(struct drm_i915_private *i915)
> @@ -647,7 +661,7 @@ int intel_migrate_live_selftests(struct drm_i915_private *i915)
>   	if (!gt->migrate.context)
>   		return 0;
>   
> -	return i915_subtests(tests, &gt->migrate);
> +	return intel_gt_live_subtests(tests, gt);
>   }
>   
>   static struct drm_i915_gem_object *
Andi Shyti Dec. 6, 2022, 4:01 p.m. UTC | #2
Hi Matt,

On Fri, Dec 02, 2022 at 12:28:43PM +0000, Matthew Auld wrote:
> Probably a good idea to do an igt_flush_test() at the end of each
> subtest, just to be sure the previous work has been flushed and doesn't
> somehow interfere with the current subtest.
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Chris Wilson <chris.p.wilson@intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Cc: Nirmoy Das <nirmoy.das@intel.com>

[...]

> @@ -647,7 +661,7 @@ int intel_migrate_live_selftests(struct drm_i915_private *i915)
>  	if (!gt->migrate.context)
>  		return 0;
>  
> -	return i915_subtests(tests, &gt->migrate);
> +	return intel_gt_live_subtests(tests, gt);

yes... this calls the gt teardown function that waits for all the
works to end and yields to userspace signals... makes sense.

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/selftest_migrate.c b/drivers/gpu/drm/i915/gt/selftest_migrate.c
index 0dc5309c90a4..1eab025ac002 100644
--- a/drivers/gpu/drm/i915/gt/selftest_migrate.c
+++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c
@@ -486,7 +486,8 @@  global_clear(struct intel_migrate *migrate, u32 sz, struct rnd_state *prng)
 
 static int live_migrate_copy(void *arg)
 {
-	struct intel_migrate *migrate = arg;
+	struct intel_gt *gt = arg;
+	struct intel_migrate *migrate = &gt->migrate;
 	struct drm_i915_private *i915 = migrate->context->engine->i915;
 	I915_RND_STATE(prng);
 	int i;
@@ -507,7 +508,8 @@  static int live_migrate_copy(void *arg)
 
 static int live_migrate_clear(void *arg)
 {
-	struct intel_migrate *migrate = arg;
+	struct intel_gt *gt = arg;
+	struct intel_migrate *migrate = &gt->migrate;
 	struct drm_i915_private *i915 = migrate->context->engine->i915;
 	I915_RND_STATE(prng);
 	int i;
@@ -593,7 +595,10 @@  static int __thread_migrate_copy(void *arg)
 
 static int thread_migrate_copy(void *arg)
 {
-	return threaded_migrate(arg, __thread_migrate_copy, 0);
+	struct intel_gt *gt = arg;
+	struct intel_migrate *migrate = &gt->migrate;
+
+	return threaded_migrate(migrate, __thread_migrate_copy, 0);
 }
 
 static int __thread_global_copy(void *arg)
@@ -605,7 +610,10 @@  static int __thread_global_copy(void *arg)
 
 static int thread_global_copy(void *arg)
 {
-	return threaded_migrate(arg, __thread_global_copy, 0);
+	struct intel_gt *gt = arg;
+	struct intel_migrate *migrate = &gt->migrate;
+
+	return threaded_migrate(migrate, __thread_global_copy, 0);
 }
 
 static int __thread_migrate_clear(void *arg)
@@ -624,12 +632,18 @@  static int __thread_global_clear(void *arg)
 
 static int thread_migrate_clear(void *arg)
 {
-	return threaded_migrate(arg, __thread_migrate_clear, 0);
+	struct intel_gt *gt = arg;
+	struct intel_migrate *migrate = &gt->migrate;
+
+	return threaded_migrate(migrate, __thread_migrate_clear, 0);
 }
 
 static int thread_global_clear(void *arg)
 {
-	return threaded_migrate(arg, __thread_global_clear, 0);
+	struct intel_gt *gt = arg;
+	struct intel_migrate *migrate = &gt->migrate;
+
+	return threaded_migrate(migrate, __thread_global_clear, 0);
 }
 
 int intel_migrate_live_selftests(struct drm_i915_private *i915)
@@ -647,7 +661,7 @@  int intel_migrate_live_selftests(struct drm_i915_private *i915)
 	if (!gt->migrate.context)
 		return 0;
 
-	return i915_subtests(tests, &gt->migrate);
+	return intel_gt_live_subtests(tests, gt);
 }
 
 static struct drm_i915_gem_object *