From: qizhong.cheng <qizhong.cheng@mediatek.com>
To: Marc Zyngier <maz@kernel.org>, Bjorn Helgaas <helgaas@kernel.org>
Cc: "Ryder Lee" <ryder.lee@mediatek.com>,
"Jianjun Wang" <jianjun.wang@mediatek.com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, chuanjia.liu@mediatek.com
Subject: Re: [PATCH] PCI: mediatek: Change MSI interrupt processing sequence
Date: Wed, 26 Jan 2022 11:37:58 +0800 [thread overview]
Message-ID: <d78b45e461b204d375830217d0d27ffdd97cedd3.camel@mediatek.com> (raw)
In-Reply-To: <e8e42eba6e7cf49bc2260f20844a7849@kernel.org>
On Tue, 2022-01-25 at 17:21 +0000, Marc Zyngier wrote:
> On 2022-01-25 16:57, Bjorn Helgaas wrote:
> > All patches change *something*. Can you update the subject line so
> > it
> > says something specific about the change?
> >
> > Maybe something like "Clear MSI status before dispatching handler"?
> >
> > On Sun, Jan 23, 2022 at 11:33:06AM +0800, qizhong cheng wrote:
> > > As an edge-triggered interrupts, its interrupt status should be
> > > cleared
> > > before dispatch to the handler of device.
> >
> > I'm not an IRQ expert, but the reasoning that "we should clear the
> > MSI
> > interrupt status before dispatching the handler because MSI is an
> > edge-triggered interrupt" doesn't seem completely convincing
> > because
> > your code will now look like this:
> >
> > /* Clear the INTx */
> > writel(1 << bit, port->base + PCIE_INT_STATUS);
> > generic_handle_domain_irq(port->irq_domain, bit - INTX_SHIFT);
> > ...
> >
> > /* Clear MSI interrupt status */
> > writel(MSI_STATUS, port->base + PCIE_INT_STATUS);
> > generic_handle_domain_irq(port->inner_domain, bit);
> >
> > You clear interrupt status before dispatching the handler for
> > *both*
> > level-triggered INTx interrupts and edge-triggered MSI interrupts.
> >
> > So it doesn't seem that simply being edge-triggered is the critical
> > factor here.
>
> This is the usual problem with these half-baked implementations.
> The signalling to the primary interrupt controller is level, as
> they take a multitude of input and (crucially) latch the MSI
> edges. Effectively, this is an edge-to-level converter, with
> all the problems that this creates.
>
> By clearing the status *after* the handling, you lose edges that
> have been received and coalesced after the read of the status
> register. By clearing it *before*, you are acknowledging the
> interrupts early, and allowing them to be coalesced independently
> of the ones that have been received earlier.
>
> This is however mostly an educated guess. Someone with access
> to the TRM should verify this.
>
Yes, as Maz said, we save the edge-interrupt status so that it becomes
a level-interrupt. This is similar to an edge-to-level converter, so we
need to clear it *before*. We found this problem through a lot of
experiments and tested this patch.
Thanks Helgaas and Maz for your comment.
--
Jazz ain't dead, dreams haven't parted with you.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-01-26 3:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-23 3:33 [PATCH] PCI: mediatek: Change MSI interrupt processing sequence qizhong cheng
2022-01-24 3:12 ` Chen-Yu Tsai
2022-01-24 6:27 ` qizhong.cheng
2022-01-24 6:55 ` Chen-Yu Tsai
2022-01-24 8:34 ` qizhong.cheng
2022-01-25 16:57 ` Bjorn Helgaas
2022-01-25 17:21 ` Marc Zyngier
2022-01-26 3:37 ` qizhong.cheng [this message]
2022-01-27 21:21 ` Bjorn Helgaas
2022-01-28 7:58 ` Jianjun Wang
2022-02-08 7:08 ` qizhong.cheng
2022-01-28 8:57 ` Marc Zyngier
2022-01-28 13:12 ` Bjorn Helgaas
2022-01-28 15:09 ` Marc Zyngier
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=d78b45e461b204d375830217d0d27ffdd97cedd3.camel@mediatek.com \
--to=qizhong.cheng@mediatek.com \
--cc=bhelgaas@google.com \
--cc=chuanjia.liu@mediatek.com \
--cc=helgaas@kernel.org \
--cc=jianjun.wang@mediatek.com \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=maz@kernel.org \
--cc=ryder.lee@mediatek.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;
as well as URLs for NNTP newsgroup(s).