accel/ivpu: Flush pending jobs of device's workqueues
PATCH 1/1 accel/ivpu: Flush pending jobs of device's workqueues
Use flush_work() instead of cancel_work_sync() for driver workqueues to guarantee that remaining pending work will be handled.
--- drivers/accel/ivpu/ivpu_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/accel/ivpu/ivpu_drv.c +3 -3
@@ -421,9 +421,9 @@ void ivpu_prepare_for_reset(struct ivpu_device *vdev) {ivpu_hw_irq_disable (vdev);disable_irq (vdev->irq); -cancel_work_sync (&vdev->irq_ipc_work); -cancel_work_sync (&vdev->irq_dct_work); -cancel_work_sync (&vdev->context_abort_work); +flush_work (&vdev->irq_ipc_work); +flush_work (&vdev->irq_dct_work); +flush_work (&vdev->context_abort_work);ivpu_ipc_disable (vdev);ivpu_mmu_disable (vdev); }
Signature · 1 line
2.43.0
Quoted 15 lines · Maciej Falkowski
Use
flush_work()instead ofcancel_work_sync()for driver workqueues to guarantee that remaining pending work will be handled.Fixes bc3e5f48b7ee ("accel/ivpu: Use workqueue for IRQ handling")Signed-off-by Maciej Falkowski <[email protected]>--- drivers/accel/ivpu/ivpu_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/accel/ivpu/ivpu_drv.c +0
-0
drivers/accel/ivpu/ivpu_drv.c void ivpu_prepare_for_reset(struct ivpu_device *vdev) · line 426
Quoted 9 lines
drivers/accel/ivpu/ivpu_drv.c +3
-3@@ -421,9 +421,9 @@ void ivpu_prepare_for_reset(struct ivpu_device *vdev) {ivpu_hw_irq_disable (vdev);disable_irq (vdev->irq); -cancel_work_sync (&vdev->irq_ipc_work); -cancel_work_sync (&vdev->irq_dct_work); -cancel_work_sync (&vdev->context_abort_work); +flush_work (&vdev->irq_ipc_work); +flush_work (&vdev->irq_dct_work); +flush_work (&vdev->context_abort_work);
Quoted 3 lines
drivers/accel/ivpu/ivpu_drv.c +0
-0ivpu_ipc_disable (vdev);ivpu_mmu_disable (vdev); }
Quoted 6 lines · Maciej Falkowski
Use
flush_work()instead ofcancel_work_sync()for driver workqueues to guarantee that remaining pending work will be handled.Fixes bc3e5f48b7ee ("accel/ivpu: Use workqueue for IRQ handling")Signed-off-by Maciej Falkowski <[email protected]>
The fixes tag suggests that this is a bug fix, but the commit text doesn't really tell me why cancel_work_sync() is bad. Does it leave the driver in some incomplete state that prevents later recovery?
Put another way, "why is it necessary for the pending work to be handled?" appears unanswered.
With that
Quoted 11 lines · Jeff Hugo
Quoted 6 lines · Maciej Falkowski
Use
flush_work()instead ofcancel_work_sync()for driver workqueues to guarantee that remaining pending work will be handled.Fixes bc3e5f48b7ee ("accel/ivpu: Use workqueue for IRQ handling")Signed-off-by Maciej Falkowski <[email protected]>The fixes tag suggests that this is a bug fix, but the commit text doesn't really tell me why
cancel_work_sync()is bad. Does it leave the driver in some incomplete state that prevents later recovery?Put another way, "why is it necessary for the pending work to be handled?" appears unanswered.
You are right, thank you for pointing this out. FYI I will include the following explanation in the patch message:
This will resolve two issues that were encountered where a driver was left in an incomplete state as the bottom-half was canceled:
a) Cancelling context-abort of a job that is still executing and is causing translation faults which is going to cause additional TDRs,
b) Cancelling bottom-half of a DCT (duty-cycle throttling) request which will cause a device to not be adjusted to an external frequency request.
Best regards,
Maciej
Quoted 3 lines
With that
Reviewed-by Jeff Hugo <[email protected]>
Applied with updated commit message to drm-misc-fixes
Quoted 27 lines · Maciej Falkowski
Use
flush_work()instead ofcancel_work_sync()for driver workqueues to guarantee that remaining pending work will be handled.Fixes bc3e5f48b7ee ("accel/ivpu: Use workqueue for IRQ handling")Signed-off-by Maciej Falkowski <[email protected]>--- drivers/accel/ivpu/ivpu_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/accel/ivpu/ivpu_drv.c +3
-3@@ -421,9 +421,9 @@ void ivpu_prepare_for_reset(struct ivpu_device *vdev) {ivpu_hw_irq_disable (vdev);disable_irq (vdev->irq); -cancel_work_sync (&vdev->irq_ipc_work); -cancel_work_sync (&vdev->irq_dct_work); -cancel_work_sync (&vdev->context_abort_work); +flush_work (&vdev->irq_ipc_work); +flush_work (&vdev->irq_dct_work); +flush_work (&vdev->context_abort_work);ivpu_ipc_disable (vdev);ivpu_mmu_disable (vdev); }