Linux RTC
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Antoni Pokusinski" <apokusinski01@gmail.com>
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	robh@kernel.org, devicetree@vger.kernel.org,
	linux-rtc@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 3/8] rtc: abx80x: properly handle shared IRQs
Date: Fri, 31 Jul 2026 19:05:22 +0000	[thread overview]
Message-ID: <20260731190522.C11D41F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260731184831.44037-4-apokusinski01@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Returning IRQ_NONE without masking or clearing unhandled RTC interrupts can cause an interrupt storm on the shared IRQ line.
--

--- Patch [3]: [PATCH v3 3/8] rtc: abx80x: properly handle shared IRQs ---
commit e06155ed4aeb662277df57a2324e881c6d065e84
Author: Antoni Pokusinski <apokusinski01@gmail.com>

rtc: abx80x: properly handle shared IRQs

This commit modifies the abx80x interrupt handler to only claim the IRQ and
clear the status register if the alarm or watchdog flags are explicitly set.
It aims to prevent claiming interrupts from other devices sharing the same
IRQ line.

> diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
> --- a/drivers/rtc/rtc-abx80x.c
> +++ b/drivers/rtc/rtc-abx80x.c

[ ... ]

> @@ -266,27 +266,34 @@ static irqreturn_t abx80x_handle_irq(int irq, void *dev_id)

[ ... ]

> -	if (status & ABX8XX_STATUS_WDT)
> +	if (status & ABX8XX_STATUS_WDT) {
>  		dev_alert(&client->dev, "watchdog timeout interrupt.\n");
> +		handled = IRQ_HANDLED;
> +	}
>  
> -	i2c_smbus_write_byte_data(client, ABX8XX_REG_STATUS, 0);
> +	if (handled == IRQ_HANDLED)
> +		i2c_smbus_write_byte_data(client, ABX8XX_REG_STATUS,
> +					  status & ~(ABX8XX_STATUS_AF | ABX8XX_STATUS_WDT));
>  
> -	return IRQ_HANDLED;
> +	return handled;

[Severity: High]
If the RTC hardware asserts an interrupt for a reason other than AF or WDT
(for example, a timer or century interrupt left enabled by a bootloader),
will this cause an interrupt storm?

Because handled remains IRQ_NONE, the handler skips the i2c_smbus_write_byte_data()
call and returns IRQ_NONE without clearing the unhandled RTC status bits.

Since the unhandled RTC interrupt is never cleared, the IRQ line will remain
asserted. This causes the kernel to immediately re-enter the handler until
the spurious IRQ detector steps in and completely disables the shared IRQ line.

Could we check if the status register indicates the interrupt originated
from this RTC, clear those bits, and return IRQ_HANDLED?

>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260731184831.44037-1-apokusinski01@gmail.com?part=3

  reply	other threads:[~2026-07-31 19:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 18:48 [PATCH v3 0/8] rtc: abx80x: add support for abx81x Antoni Pokusinski
2026-07-31 18:48 ` [PATCH v3 1/8] dt-bindings: rtc: abx80x: document ABX81X RTCs Antoni Pokusinski
2026-07-31 18:57   ` sashiko-bot
2026-07-31 18:48 ` [PATCH v3 2/8] rtc: abx80x: add mutex protection for register writes Antoni Pokusinski
2026-07-31 19:02   ` sashiko-bot
2026-07-31 18:48 ` [PATCH v3 3/8] rtc: abx80x: properly handle shared IRQs Antoni Pokusinski
2026-07-31 19:05   ` sashiko-bot [this message]
2026-07-31 18:48 ` [PATCH v3 4/8] rtc: abx80x: add irq to struct abx80x_priv Antoni Pokusinski
2026-07-31 19:04   ` sashiko-bot
2026-07-31 18:48 ` [PATCH v3 5/8] rtc: abx80x: use regmap instead of I2C specific API Antoni Pokusinski
2026-07-31 19:05   ` sashiko-bot
2026-07-31 18:48 ` [PATCH v3 6/8] rtc: abx80x: replace read-modify-write pattern with regmap helpers Antoni Pokusinski
2026-07-31 19:01   ` sashiko-bot
2026-07-31 18:48 ` [PATCH v3 7/8] rtc: abx80x: create abx80x_i2c_probe() Antoni Pokusinski
2026-07-31 19:02   ` sashiko-bot
2026-07-31 18:48 ` [PATCH v3 8/8] rtc: abx80x: add support for ABX81X Antoni Pokusinski
2026-07-31 19:05   ` sashiko-bot

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=20260731190522.C11D41F00AC4@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=apokusinski01@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=robh@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox