From: Bryan O'Donoghue <bod@kernel.org>
To: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>,
Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Hungyu Lin <dennylin0707@gmail.com>,
Stefan Schmidt <stefan.schmidt@linaro.org>,
Hans Verkuil <hverkuil@kernel.org>
Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 2/3] media: qcom: iris: Fix IRQ disable depth imbalance on watchdog interrupt
Date: Mon, 30 Nov 2026 16:56:49 +0000 [thread overview]
Message-ID: <7de93754-b7e3-4a45-81b9-c4248e8d6fee@kernel.org> (raw)
In-Reply-To: <20261120-fix-disable-irq-safely-v3-2-82f9561394cb@oss.qualcomm.com>
On 20/11/2026 07:42, Vishnu Reddy wrote:
> The hard IRQ handler disables the IRQ for every interrupt, and the
> threaded handler re-enables it for non-watchdog interrupts.
But why ?
> duplicates the masking and unmasking provided by IRQF_ONESHOT.
>
> If power-off runs after the hard handler disables the IRQ but before
> the threaded handler updates core->intr_status, and the stale status
> indicates a non-watchdog interrupt, power-off disables the IRQ again.
> The watchdog handler does not re-enable the IRQ, so the two disables
> are not balanced by the single enable in power-on.
>
> Request the IRQ with IRQF_ONESHOT and remove the hard IRQ handler.
> Explicitly disable the IRQ in the threaded handler for watchdog
> interrupts to prevent repeated triggering. Power-off always disables
> the IRQ once, and power-on balances that disable and any additional
> watchdog disable.
>
> Fixes: bb8a95aa038e ("media: iris: implement power management")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
> ---
> drivers/media/platform/qcom/iris/iris_core.h | 2 ++
> drivers/media/platform/qcom/iris/iris_hfi_common.c | 14 ++++----------
> drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 -
> drivers/media/platform/qcom/iris/iris_probe.c | 5 +++--
> drivers/media/platform/qcom/iris/iris_vpu_common.c | 7 +++++--
> 5 files changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_core.h b/drivers/media/platform/qcom/iris/iris_core.h
> index 3e4cf652bf39..468ccb551ec3 100644
> --- a/drivers/media/platform/qcom/iris/iris_core.h
> +++ b/drivers/media/platform/qcom/iris/iris_core.h
> @@ -70,6 +70,7 @@ struct qcom_ubwc_cfg_data;
> * @message_queue: shared interface queue to receive responses from firmware
> * @debug_queue: shared interface queue to receive debug info from firmware
> * @lock: a lock for this strucure
> + * @wdt_irq_disabled: IRQ was disabled by the handler on a watchdog interrupt
> * @response_packet: a pointer to response packet from fw to driver
> * @header_id: id of packet header
> * @packet_id: id of packet
> @@ -116,6 +117,7 @@ struct iris_core {
> struct iris_iface_q_info message_queue;
> struct iris_iface_q_info debug_queue;
> struct mutex lock; /* lock for core related operations */
> + bool wdt_irq_disabled;
I don't believe you need this flag at all or rather I don't get why we
need this convoluted logic.
Can we take a step back and ask why ?
For example why not this:
hard irq runs, doesn't disable anything - the interrupt gets masked
soft irq runs, does whatever, interrupt gets unmasked.
suspend - disables the irq
resume - re-enables the irq
What's the point of the flag or indeed disabling and re-enabling the
watchdog for each handled IRQ
> u8 *response_packet;
> u32 header_id;
> u32 packet_id;
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_common.c b/drivers/media/platform/qcom/iris/iris_hfi_common.c
> index dad906d03fdc..a27c543e75bc 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_common.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_common.c
> @@ -90,13 +90,6 @@ int iris_hfi_core_init(struct iris_core *core)
> return hfi_ops->sys_interframe_powercollapse(core);
> }
>
> -irqreturn_t iris_hfi_isr(int irq, void *data)
> -{
> - disable_irq_nosync(irq);
> -
> - return IRQ_WAKE_THREAD;
> -}
> -
> irqreturn_t iris_hfi_isr_handler(int irq, void *data)
> {
> struct iris_core *core = data;
> @@ -107,14 +100,15 @@ irqreturn_t iris_hfi_isr_handler(int irq, void *data)
> mutex_lock(&core->lock);
> pm_runtime_mark_last_busy(core->dev);
> iris_vpu_clear_interrupt(core);
> + if (iris_vpu_watchdog(core, core->intr_status)) {
> + disable_irq_nosync(irq);
> + core->wdt_irq_disabled = true;
> + }
> mutex_unlock(&core->lock);
>
> if (core->hfi_sys_ops)
> core->hfi_sys_ops->sys_hfi_response_handler(core);
>
> - if (!iris_vpu_watchdog(core, core->intr_status))
> - enable_irq(irq);
> -
> return IRQ_HANDLED;
> }
>
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_common.h b/drivers/media/platform/qcom/iris/iris_hfi_common.h
> index 16099f9a25b6..366c9b81675c 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_common.h
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_common.h
> @@ -157,7 +157,6 @@ int iris_hfi_core_init(struct iris_core *core);
> int iris_hfi_pm_suspend(struct iris_core *core);
> int iris_hfi_pm_resume(struct iris_core *core);
>
> -irqreturn_t iris_hfi_isr(int irq, void *data);
> irqreturn_t iris_hfi_isr_handler(int irq, void *data);
>
> #endif
> diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
> index 343e44c6b9c4..cecd2282e29c 100644
> --- a/drivers/media/platform/qcom/iris/iris_probe.c
> +++ b/drivers/media/platform/qcom/iris/iris_probe.c
> @@ -311,9 +311,10 @@ static int iris_probe(struct platform_device *pdev)
> if (IS_ERR(core->ubwc_cfg))
> return PTR_ERR(core->ubwc_cfg);
>
> - ret = devm_request_threaded_irq(core->dev, core->irq, iris_hfi_isr,
> + ret = devm_request_threaded_irq(core->dev, core->irq, NULL,
> iris_hfi_isr_handler,
> - IRQF_TRIGGER_HIGH | IRQF_NO_AUTOEN,
> + IRQF_TRIGGER_HIGH | IRQF_NO_AUTOEN |
> + IRQF_ONESHOT,
> "iris", core);
> if (ret)
> return ret;
> diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/media/platform/qcom/iris/iris_vpu_common.c
> index 1e183fc4e58c..54ee7a671ef8 100644
> --- a/drivers/media/platform/qcom/iris/iris_vpu_common.c
> +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.c
> @@ -239,8 +239,7 @@ void iris_vpu_power_off(struct iris_core *core)
> core->iris_platform_data->vpu_ops->power_off_controller(core);
> iris_unset_icc_bw(core);
>
> - if (!iris_vpu_watchdog(core, core->intr_status))
> - disable_irq_nosync(core->irq);
> + disable_irq_nosync(core->irq);
> }
>
> int iris_vpu_power_on_controller(struct iris_core *core)
> @@ -521,6 +520,10 @@ int iris_vpu_power_on(struct iris_core *core)
>
> core->iris_platform_data->vpu_ops->interrupt_init(core);
> core->intr_status = 0;
> + if (core->wdt_irq_disabled) {
> + core->wdt_irq_disabled = false;
> + enable_irq(core->irq);
> + }
> enable_irq(core->irq);
Does this enable the irq twice ? Looks like.
I don't see much logic in this enable/disable here.
This again feels like we are coding around an issue that hasn't been
well described or articulated.
I shouted abuse at the LLM and it _looks_ to me that the reason for this
flag is when the watchdog bites we schedule the reset @ ~ 10ms but leave
the watchdog IRQ enabled - requiring this mad dance with the flags.
But "just mask/disable the watchdog irq when scheduling the reset" is
much, much, much more logical and straight forward.
vpu_power_on - enable wdt
vpu_power_off - disable wdt
wdog bites - mask the wdt irq schedule firmware restart
Let's do that ?
>
> return 0;
>
> --
> 2.34.1
next prev parent reply other threads:[~2026-11-30 16:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 7:42 [PATCH v3 0/3] media: qcom: iris: Fix IRQ synchronization during power-off Vishnu Reddy
2026-11-20 7:42 ` [PATCH v3 1/3] Revert "media: qcom: iris: use disable_irq() during power-off" Vishnu Reddy
2026-11-27 13:55 ` Vikash Garodia
2026-11-20 7:42 ` [PATCH v3 2/3] media: qcom: iris: Fix IRQ disable depth imbalance on watchdog interrupt Vishnu Reddy
2026-11-27 13:58 ` Vikash Garodia
2026-11-30 16:56 ` Bryan O'Donoghue [this message]
2026-11-20 7:42 ` [PATCH v3 3/3] media: qcom: iris: Skip register access in IRQ handler after power-off Vishnu Reddy
2026-11-27 13:59 ` Vikash Garodia
2026-11-25 6:06 ` [PATCH v3 0/3] media: qcom: iris: Fix IRQ synchronization during power-off Wangao Wang
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=7de93754-b7e3-4a45-81b9-c4248e8d6fee@kernel.org \
--to=bod@kernel.org \
--cc=abhinav.kumar@linux.dev \
--cc=bryan.odonoghue@linaro.org \
--cc=busanna.reddy@oss.qualcomm.com \
--cc=dennylin0707@gmail.com \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=hverkuil@kernel.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=stable@vger.kernel.org \
--cc=stefan.schmidt@linaro.org \
--cc=vikash.garodia@oss.qualcomm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®