From: Binbin Zhou <zhoubinbin@loongson.cn>
To: Andy Shevchenko <andriy.shevchenko@intel.com>,
David Carlier <devnexen@gmail.com>
Cc: Andi Shyti <andi.shyti@kernel.org>,
Huacai Chen <chenhuacai@loongson.cn>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
zhoubb.aaron@gmail.com
Subject: Re: [PATCH] i2c: ls2x-v2: return IRQ_HANDLED after servicing an error
Date: Wed, 6 May 2026 17:59:53 +0800 [thread overview]
Message-ID: <d6127cff-b8fa-4a03-a74f-5afa178cb39d@loongson.cn> (raw)
In-Reply-To: <afsF2y0_oe2IloXT@ashevche-desk.local>
Hi all:
On 2026/5/6 17:11, Andy Shevchenko wrote:
> On Wed, May 06, 2026 at 05:48:18AM +0100, David Carlier wrote:
>> The event ISR reads SR1 and, when an error flag (ARLO/AF/BERR) is set,
>> calls loongson2_i2c_isr_error() which clears the offending flag, issues
>> STOP for the AF case, records msg->result, masks every CR2 interrupt
>> enable and completes the waiter. The handler then returns IRQ_NONE,
>> declaring to the IRQ core that the device did not interrupt.
>>
>> That report is wrong. The device did interrupt and the handler fully
>> serviced it. Because the IRQ is requested with IRQF_SHARED, the genirq
>> spurious-IRQ tracker counts each error as unhandled. A bus that emits
>> sporadic NACKs, arbitration losses or bus errors will therefore march
>> toward the spurious-IRQ threshold and the line can end up disabled,
>> wedging the controller.
> Have you exhibited this on a real HW?
>
>> Return IRQ_HANDLED on this path. The other IRQ_NONE site, taken when
>> neither an event nor an error bit is set, remains correct.
> Hmm... This sounds logical, but we need the Loongson folks to confirm as this
> is sensitive code and changes like this may affect existing work flows.
I will try to test this boundary case in the next couple of days.
>
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-ls2x-v2.c b/drivers/i2c/busses/i2c-ls2x-v2.c
>> index 517760d70169..9df73557ecc4 100644
>> --- a/drivers/i2c/busses/i2c-ls2x-v2.c
>> +++ b/drivers/i2c/busses/i2c-ls2x-v2.c
>> @@ -304,7 +304,7 @@ static irqreturn_t loongson2_i2c_isr_event(int irq, void *data)
>> regmap_read(priv->regmap, LOONGSON2_I2C_SR1, &status);
>> if (status & LOONGSON2_I2C_SR1_ITERREN_MASK) {
>> loongson2_i2c_isr_error(status, data);
>> - return IRQ_NONE;
>> + return IRQ_HANDLED;
>> }
>>
>> regmap_read(priv->regmap, LOONGSON2_I2C_CR2, &cr2);
> P.S.
> Is the analysis and/or commit message AI assisted?
Thanks.
Binbin
>
next prev parent reply other threads:[~2026-05-06 10:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 4:48 [PATCH] i2c: ls2x-v2: return IRQ_HANDLED after servicing an error David Carlier
2026-05-06 9:11 ` Andy Shevchenko
2026-05-06 9:59 ` Binbin Zhou [this message]
[not found] ` <CA+XhMqw=WCkAn66X=P29ojx=wOVezfjnwvDbxYnZ1FOK=4Z8ng@mail.gmail.com>
2026-05-06 10:36 ` Andy Shevchenko
2026-05-06 15:40 ` [PATCH v2] " David Carlier
2026-05-06 15:48 ` Andy Shevchenko
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=d6127cff-b8fa-4a03-a74f-5afa178cb39d@loongson.cn \
--to=zhoubinbin@loongson.cn \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=chenhuacai@loongson.cn \
--cc=devnexen@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhoubb.aaron@gmail.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