[PATCH] drm/amd/amdgpu: remove redundant flush_delayed_work

Christian König ckoenig.leichtzumerken at gmail.com
Mon Jan 18 08:48:57 UTC 2021


Am 18.01.21 um 03:47 schrieb Jingwen Chen:
> When using cancel_delayed_work_sync, there's no need
> to flush_delayed_work first. This sequence can lead to
> a redundant loop of work executing.

Well the difference is that cancel_delayed_work_sync() cancels the work 
when it is not running yet and waits for the work to finish if it is 
already running.

flush_delayed_work() always waits for the work to finish.

You need to remove the cancel_delayed_work_sync not the flush if you 
want to keep the functionality the same.

Regards,
Christian.

>
> Signed-off-by: Jingwen Chen <Jingwen.Chen2 at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 3e212862cf5d..c649944e49da 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -569,7 +569,6 @@ void amdgpu_virt_fini_data_exchange(struct amdgpu_device *adev)
>   {
>   	if (adev->virt.vf2pf_update_interval_ms != 0) {
>   		DRM_INFO("clean up the vf2pf work item\n");
> -		flush_delayed_work(&adev->virt.vf2pf_work);
>   		cancel_delayed_work_sync(&adev->virt.vf2pf_work);
>   		adev->virt.vf2pf_update_interval_ms = 0;
>   	}



More information about the amd-gfx mailing list