From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796057815; b=gZ+2a2v1M+JSblYaqP/I+AaHniD/+6dbTkk7i/WxYWvMszpgnxENISrF7JX9RoPHjjh2 5TBBlzCefnMKiugFvZMc9SwHAOxk0nRvpNik4YVGdqntozr51xHdMtSFppObfgyuc8v/S Om/rpsi+1RHhtRZgGi2y5sP19RC0Q9FJeyaVikcc7+i54oENuldJqoAPcz65Y3Y4dGtXk dSTq5Z0eETZHrQnru1djGm1pxYUYCvcQq93kxqLLMqfPZPoC5USVPAFksEMqlsvPpsPQW C30J8C32RAAaY6uRZU8d6gsQi1fzN3vicPB2tWCihRRJ4JzKVXPO9i427+6bKGr5Lpg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796057815; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:Content-Language:Autocrypt:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=BJqWgDkOdHcWUiy75VJXBcoJPxr8d+jKSNKKwqgB5wM=; b=1mU5UjIXpKXFFq+VLEdZjM+8hWASi8ydksmr8JYKxt68fkfkuoyzzOH0tgA3jtJeTqm3 RtC0Dq3U95x2zCyMWivl/lgwenrdPN6JVEp7N64RfygduBJnmgskml/XjZT18Rs/cP6J7 8SLYy4VaLJNXl4l6FA0hZqP7CIEwjdyaPH39NEgoUnxUiMbjv0DG69cmxJpLQDDLN3nvq EMI+jZYum3H0FoRlR7cj7PoH1Bi1AijFvpQYpgIKwyMVAH3ceONB1K2oSOeM635PSUDZy h6j+G5DWeZ/BnExKDEwREeQg9jccY+1XQsxYfdVeKaoDzfwAmlTivkZz/G9RtX0VaPQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YOeRhnAh; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85239606A31C; Mon, 30 Nov 2026 16:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YOeRhnAh Received: by smtp.kernel.org (Postfix) with ESMTPSA id A212B1F00896; Mon, 30 Nov 2026 16:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796057815; bh=BJqWgDkOdHcWUiy75VJXBcoJPxr8d+jKSNKKwqgB5wM=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=YOeRhnAhAM56lxMeUF0j79dM/QQ3dFafrTb3kKOT0LHKOl0ueIjevb6ukSFzeUTPX 6AilkmhThnR6nzvLYsujgdZ3cMoYIOUfyBeykDg1BRPkt+LasDvDyoK0XvvH8mRJjw tndDjjBuh2OLuUoXxCVALdY1fGIBAogkKcF7APRXQBYCUGGQeNSagQegdypTV5WoAp vrThUUmdbKkexvyOqboVzYQvE28sLMF0grv9Av8/1l5tAjJYmoUEyeuOQcQUOk56P+ MPCzkh3H5JwRYLQeGUD6aJLYkugBQ7TXlc9EYKdgSCxrK801ZDU9fKj3P0p3o/NR9L vrGDPZRZyfchQ== Message-ID: <7de93754-b7e3-4a45-81b9-c4248e8d6fee@kernel.org> Date: Mon, 30 Nov 2026 16:56:49 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/3] media: qcom: iris: Fix IRQ disable depth imbalance on watchdog interrupt To: Vishnu Reddy , Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Mauro Carvalho Chehab , Konrad Dybcio , Dmitry Baryshkov , Hungyu Lin , Stefan Schmidt , Hans Verkuil Cc: Bryan O'Donoghue , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20261120-fix-disable-irq-safely-v3-0-82f9561394cb@oss.qualcomm.com> <20261120-fix-disable-irq-safely-v3-2-82f9561394cb@oss.qualcomm.com> From: Bryan O'Donoghue Content-Language: en-GB Autocrypt: addr=bod@kernel.org; keydata= xsFNBGRJNSgBEADD7Vm2ZFa+v+JGJ2QYTJqQAkqis/uOHkhdFNXqpBarVBd47QU/DMNU5Rxg jedMQEmHoeDbJ6UOpjbrUQ63c5sgG1JbroHJJctwsEI75OOlekMuebEbjIJBLfgENGwPBMHv piv5TgCWr0VgYaXfp2eh2LINFywzqj823HiDPibQAXDrjzvF1ogksi/6cQZs8d4if8YQkLOr YISFouG+eR0nN1I7mUfIddXOWu6lJeTyqbWVurv58k2ekIXKaOC9ixLHFbcfYV0hOgRaTwQC B8CYF9nfqZla19iItfsN9QxN+ZdQjcRoYipp6HPCMfJlKH7GfaFcW93LKc4DKJ2lVL+pg/OQ lythZbjRPY492NG9kZ65aYstCs90uhMUEVVPuGUw7wBEku+6IEwZfrbMVKeWzLlPyM4Hv9hM 8ktxSmxWsPTPqpBC8eyeAQLalMELAyVcZlkaCtEcbj7w4l/JkYz+4l37obG8ZD+B34udBUUz MsAJ8foDFrBh2MOFA3hxD6G90D23mmWsri7pnKA2tZs92aQX7Ee+FbCyg6g5ln62Sq83ZDbf 53DdBs55EVpBadeInWmXhzCHPQx06H+CwTEjShTYIaMmBfrewvYUDKvFTC5iKQhAEUgt6i94 JsbG7NoeqcxkUMcBOEUQ3uCQG1D70ugspgXc0wd3Rimiq6535wARAQABzSFCcnlhbiBPJ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ba6rPfuuXPaDjCyyKn6zSVHETnHW 3AJbgVY50T8STpnxayBQvWbCvu+6NOEjXCbyaOJig+5l0zlGN9XHjdANXC5HnwmyaGRL9YDq Jh2nVXVJDincOdQRdKcJjYLqaOAoWrYWSDi1iZGspHBTDrnOvfMQzzHY In-Reply-To: <20261120-fix-disable-irq-safely-v3-2-82f9561394cb@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 > --- > 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