Skip to contentSkip to conversation

drm/amd/amdgpu: remove redundant flush_delayed_work

PATCH In review Jingwen Chen 3 participants 3 messages Jan 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: remove redundant flush_delayed_work

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -1
index 3e212862cf5d..c649944e49da 100644
@@ -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;
 	}
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - Internal Distribution Only]

Thanks

------------------------------------------
Monk Liu | Cloud-GPU Core team
------------------------------------------

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jingwen Chen
Sent: Monday, January 18, 2021 10:47 AM
To: [email protected]
Cc: Chen, JingWen <[email protected]>
Subject: [PATCH] drm/amd/amdgpu: remove redundant flush_delayed_work

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -2
index 3e212862cf5d..c649944e49da 100644
@@ -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;
 	}
--

2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cmonk.liu%40amd.com%7C959a668e79e44b56af7708d8bb5b7457%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637465348766384167%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=zr9WvU7%2B%2B3cx9O2Vb8nIFYa9PZAT7bFOkdecY%2FLXdMI%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw
In reply to Jingwen Chen

Am 18.01.21 um 03:47 schrieb Jingwen Chen:

Quoted 3 lines

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.

Quoted 11 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 -
  1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -0
index 3e212862cf5d..c649944e49da 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c void amdgpu_virt_fini_data_exchange(struct amdgpu_device *adev) · line 574

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -1
@@ -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;
  	}

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx