diff mbox series

[v4,04/14] drm/sched: Cancel and flush all oustatdning jobs before finish.

Message ID 1611003683-3534-5-git-send-email-andrey.grodzovsky@amd.com (mailing list archive)
State New, archived
Headers show
Series RFC Support hot device unplug in amdgpu | expand

Commit Message

Andrey Grodzovsky Jan. 18, 2021, 9:01 p.m. UTC
To avoid any possible use after free.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/scheduler/sched_main.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Alex Deucher Jan. 18, 2021, 9:49 p.m. UTC | #1
On Mon, Jan 18, 2021 at 4:02 PM Andrey Grodzovsky
<andrey.grodzovsky@amd.com> wrote:
>
> To avoid any possible use after free.
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>

In the subject:
oustatdning -> outstanding

Alex


> ---
>  drivers/gpu/drm/scheduler/sched_main.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 997aa15..92637b7 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -899,6 +899,9 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched)
>         if (sched->thread)
>                 kthread_stop(sched->thread);
>
> +       /* Confirm no work left behind accessing device structures */
> +       cancel_delayed_work_sync(&sched->work_tdr);
> +
>         sched->ready = false;
>  }
>  EXPORT_SYMBOL(drm_sched_fini);
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König Jan. 19, 2021, 8:42 a.m. UTC | #2
This is a bug fix and should probably be pushed separately to drm-misc-next.

Christian.

Am 18.01.21 um 22:01 schrieb Andrey Grodzovsky:
> To avoid any possible use after free.
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/scheduler/sched_main.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 997aa15..92637b7 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -899,6 +899,9 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched)
>   	if (sched->thread)
>   		kthread_stop(sched->thread);
>   
> +	/* Confirm no work left behind accessing device structures */
> +	cancel_delayed_work_sync(&sched->work_tdr);
> +
>   	sched->ready = false;
>   }
>   EXPORT_SYMBOL(drm_sched_fini);
Christian König Jan. 19, 2021, 9:50 a.m. UTC | #3
Added a CC: stable tag and pushed it.

Thanks,
Christian.

Am 19.01.21 um 09:42 schrieb Christian König:
> This is a bug fix and should probably be pushed separately to 
> drm-misc-next.
>
> Christian.
>
> Am 18.01.21 um 22:01 schrieb Andrey Grodzovsky:
>> To avoid any possible use after free.
>>
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>> Reviewed-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/gpu/drm/scheduler/sched_main.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/scheduler/sched_main.c 
>> b/drivers/gpu/drm/scheduler/sched_main.c
>> index 997aa15..92637b7 100644
>> --- a/drivers/gpu/drm/scheduler/sched_main.c
>> +++ b/drivers/gpu/drm/scheduler/sched_main.c
>> @@ -899,6 +899,9 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched)
>>       if (sched->thread)
>>           kthread_stop(sched->thread);
>>   +    /* Confirm no work left behind accessing device structures */
>> +    cancel_delayed_work_sync(&sched->work_tdr);
>> +
>>       sched->ready = false;
>>   }
>>   EXPORT_SYMBOL(drm_sched_fini);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 997aa15..92637b7 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -899,6 +899,9 @@  void drm_sched_fini(struct drm_gpu_scheduler *sched)
 	if (sched->thread)
 		kthread_stop(sched->thread);
 
+	/* Confirm no work left behind accessing device structures */
+	cancel_delayed_work_sync(&sched->work_tdr);
+
 	sched->ready = false;
 }
 EXPORT_SYMBOL(drm_sched_fini);