diff mbox series

[1/1] drm/i915/gt: Wait longer for tasks in migrate selftest

Message ID 20230828192852.2894671-2-jonathan.cavitt@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/gt: Wait longer for tasks in migrate selftest | expand

Commit Message

Cavitt, Jonathan Aug. 28, 2023, 7:28 p.m. UTC
The thread_global_copy subtest of the live migrate selftest creates a
large number of threads and waits 10ms for them all to start.  This is
not enough time to wait for the threaded tasks to start, as some may
need to wait for additional ring space to be granted.  Threads that do
so are at risk of getting stopped (signaled) in the middle of waiting
for additional space, which can result in ERESTARTSYS getting reported
erroneously by i915_request_wait.

Instead of waiting a flat 10ms for the threads to start, wait 10ms per
thread.  This grants enough of a buffer for each thread to wait for
additional ring space when needed.

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
 drivers/gpu/drm/i915/gt/selftest_migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andi Shyti Aug. 31, 2023, 3:01 p.m. UTC | #1
Hi Jonathan,

On Mon, Aug 28, 2023 at 12:28:52PM -0700, Jonathan Cavitt wrote:
> The thread_global_copy subtest of the live migrate selftest creates a
> large number of threads and waits 10ms for them all to start.  This is
> not enough time to wait for the threaded tasks to start, as some may
> need to wait for additional ring space to be granted.  Threads that do
> so are at risk of getting stopped (signaled) in the middle of waiting
> for additional space, which can result in ERESTARTSYS getting reported
> erroneously by i915_request_wait.
> 
> Instead of waiting a flat 10ms for the threads to start, wait 10ms per
> thread.  This grants enough of a buffer for each thread to wait for
> additional ring space when needed.
> 
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>

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

Andi

> ---
>  drivers/gpu/drm/i915/gt/selftest_migrate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/selftest_migrate.c b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> index 3def5ca72dec..1a34cbe04fb6 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_migrate.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> @@ -710,7 +710,7 @@ static int threaded_migrate(struct intel_migrate *migrate,
>  		thread[i].tsk = tsk;
>  	}
>  
> -	msleep(10); /* start all threads before we kthread_stop() */
> +	msleep(10 * n_cpus); /* start all threads before we kthread_stop() */
>  
>  	for (i = 0; i < n_cpus; ++i) {
>  		struct task_struct *tsk = thread[i].tsk;
> -- 
> 2.25.1
Andi Shyti Aug. 31, 2023, 6:18 p.m. UTC | #2
Hi Jonathan,

On Mon, Aug 28, 2023 at 12:28:52PM -0700, Jonathan Cavitt wrote:
> The thread_global_copy subtest of the live migrate selftest creates a
> large number of threads and waits 10ms for them all to start.  This is
> not enough time to wait for the threaded tasks to start, as some may
> need to wait for additional ring space to be granted.  Threads that do
> so are at risk of getting stopped (signaled) in the middle of waiting
> for additional space, which can result in ERESTARTSYS getting reported
> erroneously by i915_request_wait.
> 
> Instead of waiting a flat 10ms for the threads to start, wait 10ms per
> thread.  This grants enough of a buffer for each thread to wait for
> additional ring space when needed.
> 
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>

Applied to drm-intel-gt-next.

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 3def5ca72dec..1a34cbe04fb6 100644
--- a/drivers/gpu/drm/i915/gt/selftest_migrate.c
+++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c
@@ -710,7 +710,7 @@  static int threaded_migrate(struct intel_migrate *migrate,
 		thread[i].tsk = tsk;
 	}
 
-	msleep(10); /* start all threads before we kthread_stop() */
+	msleep(10 * n_cpus); /* start all threads before we kthread_stop() */
 
 	for (i = 0; i < n_cpus; ++i) {
 		struct task_struct *tsk = thread[i].tsk;