All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] accel/ivpu: Ensure rpm_runtime_put in case of engine reset/resume fail
@ 2025-09-16  8:48 Karol Wachowski
  2025-09-16 15:22 ` Lizhi Hou
  0 siblings, 1 reply; 3+ messages in thread
From: Karol Wachowski @ 2025-09-16  8:48 UTC (permalink / raw)
  To: dri-devel
  Cc: oded.gabbay, jeff.hugo, maciej.falkowski, lizhi.hou,
	Karol Wachowski

Previously, aborting work could return early after engine reset or resume
failure, skipping the necessary runtime_put cleanup leaving the device
with incorrect reference count breaking runtime power management state.

Replace early returns with goto statements to ensure runtime_put is always
executed.

Fixes: a47e36dc5d90 ("accel/ivpu: Trigger device recovery on engine reset/resume failure")
Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
---
v0 -> v1:
Added 'Fixes:' tag.
---
 drivers/accel/ivpu/ivpu_job.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
index 521b7ac6e35e..044268d0fc87 100644
--- a/drivers/accel/ivpu/ivpu_job.c
+++ b/drivers/accel/ivpu/ivpu_job.c
@@ -1050,7 +1050,7 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
 
 	if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW)
 		if (ivpu_jsm_reset_engine(vdev, 0))
-			return;
+			goto runtime_put;
 
 	mutex_lock(&vdev->context_list_lock);
 	xa_for_each(&vdev->context_xa, ctx_id, file_priv) {
@@ -1074,7 +1074,7 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
 		goto runtime_put;
 
 	if (ivpu_jsm_hws_resume_engine(vdev, 0))
-		return;
+		goto runtime_put;
 	/*
 	 * In hardware scheduling mode NPU already has stopped processing jobs
 	 * and won't send us any further notifications, thus we have to free job related resources
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] accel/ivpu: Ensure rpm_runtime_put in case of engine reset/resume fail
  2025-09-16  8:48 [PATCH v1] accel/ivpu: Ensure rpm_runtime_put in case of engine reset/resume fail Karol Wachowski
@ 2025-09-16 15:22 ` Lizhi Hou
  2025-09-18  6:34   ` Karol Wachowski
  0 siblings, 1 reply; 3+ messages in thread
From: Lizhi Hou @ 2025-09-16 15:22 UTC (permalink / raw)
  To: Karol Wachowski, dri-devel; +Cc: oded.gabbay, jeff.hugo, maciej.falkowski

Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>

On 9/16/25 01:48, Karol Wachowski wrote:
> Previously, aborting work could return early after engine reset or resume
> failure, skipping the necessary runtime_put cleanup leaving the device
> with incorrect reference count breaking runtime power management state.
>
> Replace early returns with goto statements to ensure runtime_put is always
> executed.
>
> Fixes: a47e36dc5d90 ("accel/ivpu: Trigger device recovery on engine reset/resume failure")
> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
> ---
> v0 -> v1:
> Added 'Fixes:' tag.
> ---
>   drivers/accel/ivpu/ivpu_job.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
> index 521b7ac6e35e..044268d0fc87 100644
> --- a/drivers/accel/ivpu/ivpu_job.c
> +++ b/drivers/accel/ivpu/ivpu_job.c
> @@ -1050,7 +1050,7 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
>   
>   	if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW)
>   		if (ivpu_jsm_reset_engine(vdev, 0))
> -			return;
> +			goto runtime_put;
>   
>   	mutex_lock(&vdev->context_list_lock);
>   	xa_for_each(&vdev->context_xa, ctx_id, file_priv) {
> @@ -1074,7 +1074,7 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
>   		goto runtime_put;
>   
>   	if (ivpu_jsm_hws_resume_engine(vdev, 0))
> -		return;
> +		goto runtime_put;
>   	/*
>   	 * In hardware scheduling mode NPU already has stopped processing jobs
>   	 * and won't send us any further notifications, thus we have to free job related resources

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] accel/ivpu: Ensure rpm_runtime_put in case of engine reset/resume fail
  2025-09-16 15:22 ` Lizhi Hou
@ 2025-09-18  6:34   ` Karol Wachowski
  0 siblings, 0 replies; 3+ messages in thread
From: Karol Wachowski @ 2025-09-18  6:34 UTC (permalink / raw)
  To: Lizhi Hou, dri-devel; +Cc: oded.gabbay, jeff.hugo, maciej.falkowski

Applied to drm-misc-next

On 9/16/2025 5:22 PM, Lizhi Hou wrote:
> Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
>
> On 9/16/25 01:48, Karol Wachowski wrote:
>> Previously, aborting work could return early after engine reset or
>> resume
>> failure, skipping the necessary runtime_put cleanup leaving the device
>> with incorrect reference count breaking runtime power management state.
>>
>> Replace early returns with goto statements to ensure runtime_put is
>> always
>> executed.
>>
>> Fixes: a47e36dc5d90 ("accel/ivpu: Trigger device recovery on engine
>> reset/resume failure")
>> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
>> ---
>> v0 -> v1:
>> Added 'Fixes:' tag.
>> ---
>>   drivers/accel/ivpu/ivpu_job.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/accel/ivpu/ivpu_job.c
>> b/drivers/accel/ivpu/ivpu_job.c
>> index 521b7ac6e35e..044268d0fc87 100644
>> --- a/drivers/accel/ivpu/ivpu_job.c
>> +++ b/drivers/accel/ivpu/ivpu_job.c
>> @@ -1050,7 +1050,7 @@ void ivpu_context_abort_work_fn(struct
>> work_struct *work)
>>         if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW)
>>           if (ivpu_jsm_reset_engine(vdev, 0))
>> -            return;
>> +            goto runtime_put;
>>         mutex_lock(&vdev->context_list_lock);
>>       xa_for_each(&vdev->context_xa, ctx_id, file_priv) {
>> @@ -1074,7 +1074,7 @@ void ivpu_context_abort_work_fn(struct
>> work_struct *work)
>>           goto runtime_put;
>>         if (ivpu_jsm_hws_resume_engine(vdev, 0))
>> -        return;
>> +        goto runtime_put;
>>       /*
>>        * In hardware scheduling mode NPU already has stopped
>> processing jobs
>>        * and won't send us any further notifications, thus we have to
>> free job related resources

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-18  6:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16  8:48 [PATCH v1] accel/ivpu: Ensure rpm_runtime_put in case of engine reset/resume fail Karol Wachowski
2025-09-16 15:22 ` Lizhi Hou
2025-09-18  6:34   ` Karol Wachowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.