From: sashiko-bot@kernel.org
To: "Karol Wachowski" <karol.wachowski@linux.intel.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] accel/ivpu: Defer recovery until probe completes
Date: Tue, 10 Nov 2026 09:13:56 +0000 [thread overview]
Message-ID: <sashiko-outbox-206716@kernel.org> (raw)
In-Reply-To: <20261110085003.3527014-1-karol.wachowski@linux.intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] accel/ivpu: race in ivpu_pm_enable() queues recovery_work
twice
--
commit 53feec71cd6cb0035da92ea965a242f974fa21d7
Author: Karol Wachowski <karol.wachowski@linux.intel.com>
accel/ivpu: Defer recovery until probe completes
This commit disables recovery_work in ivpu_pm_init() and re-enables and
flushes it in ivpu_pm_enable() to prevent recovery from running during
probe before device initialization finishes.
> diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
> index aa813262253e4..7aee728b19ef1 100644
> --- a/drivers/accel/ivpu/ivpu_pm.c
> +++ b/drivers/accel/ivpu/ivpu_pm.c
> @@ -415,6 +415,7 @@ void ivpu_pm_init(struct ivpu_device *vdev)
> atomic_set(&pm->engine_reset_counter, 0);
>
> INIT_WORK(&pm->recovery_work, ivpu_pm_recovery_work);
> + disable_work(&pm->recovery_work);
> INIT_DELAYED_WORK(&pm->job_timeout_work, ivpu_job_timeout_work);
>
> if (ivpu_disable_recovery)
> @@ -439,6 +440,12 @@ void ivpu_pm_enable(struct ivpu_device *vdev)
> {
> struct device *dev = vdev->drm.dev;
>
> + enable_work(&vdev->pm->recovery_work);
> + if (atomic_read(&vdev->pm->reset_pending)) {
> + queue_work(system_dfl_wq, &vdev->pm->recovery_work);
> + flush_work(&vdev->pm->recovery_work);
> + }
[Severity: Medium]
Can ivpu_pm_enable() race with ivpu_pm_trigger_recovery() and queue
recovery_work twice for a single fault?
In ivpu_pm_trigger_recovery(), reset_pending is set to 1 before
ivpu_hw_diagnose_failure(), ivpu_hw_irq_disable(), and queue_work():
drivers/accel/ivpu/ivpu_pm.c:ivpu_pm_trigger_recovery() {
...
if (atomic_cmpxchg(&vdev->pm->reset_pending, 0, 1) == 0) {
ivpu_hw_diagnose_failure(vdev);
ivpu_hw_irq_disable(vdev); /* Disable IRQ early to protect from IRQ storm */
queue_work(system_dfl_wq, &vdev->pm->recovery_work);
}
}
And reset_pending stays 1 until ivpu_pm_reset_complete() finishes, while
the workqueue clears WORK_STRUCT_PENDING_BIT as soon as a worker dequeues
recovery_work:
CPU0 CPU1 kworker
ivpu_pm_trigger_recovery()
atomic_cmpxchg(reset_pending, 0, 1)
ivpu_hw_diagnose_failure()
ivpu_pm_enable()
enable_work(&recovery_work)
if (atomic_read(reset_pending))
queue_work(&recovery_work)
flush_work(&recovery_work)
ivpu_pm_recovery_work()
ivpu_hw_irq_disable()
queue_work(&recovery_work) <-- queued a second time
The same double queueing happens if ivpu_pm_trigger_recovery() runs right
after enable_work() and a worker starts ivpu_pm_recovery_work() before
ivpu_pm_enable() checks reset_pending.
In the first interleaving, ivpu_pm_recovery_work() runs concurrently with
ivpu_hw_diagnose_failure() and ivpu_hw_irq_disable(), and flush_work()
only waits for the first execution. The second queued recovery_work then
runs after flush_work() returns, performing a second full NPU reset
concurrently with pm_runtime_allow() and pm_runtime_put_autosuspend() and
reintroducing the race where recovery disables runtime PM during the
initial autosuspend request.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110085003.3527014-1-karol.wachowski@linux.intel.com?part=1
next prev parent reply other threads:[~2026-11-10 9:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 17:42 [PATCH] accel/ivpu: Disable recovery work on probe failure Daksh Sahni
2026-11-07 18:00 ` sashiko-bot
2026-11-10 8:33 ` Karol Wachowski
2026-11-10 8:50 ` [PATCH v2] accel/ivpu: Defer recovery until probe completes Karol Wachowski
2026-11-10 9:13 ` sashiko-bot [this message]
2026-11-10 11:41 ` Karol Wachowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-206716@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=karol.wachowski@linux.intel.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.