accel/ivpu: Synchronize context abort work with device reset
Karol Wachowski
maintainerPATCH 1/1 accel/ivpu: Synchronize context abort work with device reset
From: Jozef Wludzik <[email protected]>
Acquire pm->reset_lock in ivpu_context_abort_work_fn() to prevent it from running concurrently with a device reset. If the lock cannot be acquired immediately, skip the abort work to avoid racing with reset. The device power management is disabled during reset.
--- drivers/accel/ivpu/ivpu_job.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_job.c +6 -1
@@ -1311,9 +1311,12 @@ void ivpu_context_abort_work_fn(struct work_struct *work)unsigned long ctx_id;unsigned long id; -if (drm_WARN_ON (&vdev->drm,pm_runtime_get_if_active (vdev->drm.dev) <=0 )) +if (!down_read_trylock (&vdev->pm->reset_lock))return ; +if (drm_WARN_ON (&vdev->drm,pm_runtime_get_if_active (vdev->drm.dev) <=0 )) + goto unlock; +if (vdev->fw->sched_mode ==VPU_SCHEDULING_MODE_HW )if (reset_engine_and_mark_faulty_contexts (vdev)) goto runtime_put;
@@ -1354,4 +1357,6 @@ void ivpu_context_abort_work_fn(struct work_struct *work) runtime_put:pm_runtime_put_autosuspend (vdev->drm.dev); +unlock: +up_read (&vdev->pm->reset_lock); }
Signature · 1 line
2.43.0
Quoted 7 lines · Karol Wachowski
From: Jozef Wludzik <[email protected]>
Acquire
pm->reset_lockinivpu_context_abort_work_fn()to prevent it from running concurrently with a device reset. If the lock cannot be acquired immediately, skip the abort work to avoid racing with reset. The device power management is disabled during reset.
Quoted 5 lines
Signed-off-by Jozef Wludzik <[email protected]>Signed-off-by Karol Wachowski <[email protected]>--- drivers/accel/ivpu/ivpu_job.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 10 lines · Dawid Osuchowski
Quoted 7 lines · Karol Wachowski
From: Jozef Wludzik <[email protected]>
Acquire
pm->reset_lockinivpu_context_abort_work_fn()to prevent it from running concurrently with a device reset. If the lock cannot be acquired immediately, skip the abort work to avoid racing with reset. The device power management is disabled during reset.Reviewed-by Dawid Osuchowski <[email protected]>
Thanks, applied to drm-misc-next.
Quoted 5 lines
Quoted 5 lines
Signed-off-by Jozef Wludzik <[email protected]>Signed-off-by Karol Wachowski <[email protected]>---
drivers/accel/ivpu/ivpu_job.c| 7 ++++++-1 file changed, 6 insertions(+), 1 deletion(-)