Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: "Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
	"Benoît Monin" <benoit.monin@bootlin.com>,
	"Théo Lebrun" <theo.lebrun@bootlin.com>,
	"Thomas Gleixner" <tglx@kernel.org>,
	"Radu Rendec" <radu@rendec.net>, "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller
Date: Thu, 03 Dec 2026 17:14:26 +0100	[thread overview]
Message-ID: <87cxriz6hp.fsf@BLaptop.bootlin.com> (raw)
In-Reply-To: <20261203-eyeq5_msi-v6-0-8ffe74494bd2@bootlin.com>

Hello,

[...]

> This sixth series addresses the ACK/disable_irq() race reported by Thomas
> Gleixner. The MSI is now acknowledged from the irq_chip callback under
> desc->lock instead of clearing GCSR_IRQSTATUS in the chained handler, so a
> concurrent disable_irq() can no longer clear a status bit that must stay
> latched. A dedicated race test reproduces the loss on v5 and passes with
> this change.

Argh, Sashiko just pointed me a bug with missing
irq_pre_redirect. Indeed in this version, I kept `IRQ_DISABLE_UNLAZY`
and I removed `irq_pre_redirect()`. I did this because I did not want to
add a new core API that lets the driver set `IRQ_MASKED`. The driver
needs this API only when `irq_pre_redirect()` masks a disabled vector
itself. But this decision made me too focused on the `disable_irq()`
race. So I did not see the SMP redirect case. In that case, the deferred
ACK lets the level parent interrupt fire again. I will rework the code
as Sashiko suggests.

Sorry for the mess, I will then submitting a new version again next
week, I see that there are also other suggestion from Sashiko I will
review them too.

Grégory

>
> Grégory
>
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> ---
> Changes in v6:
> - irqchip: address the ACK path review from Thomas Gleixner:
>   - acknowledge from the irq_chip callback under desc->lock instead of
>     write-one-to-clearing GCSR_IRQSTATUS in the chained handler, so a
>     concurrent disable_irq() cannot clear a status bit that must stay
>     latched;
>   - skip the acknowledge while the vector is disabled so the hardware
>     retriggers it on unmask;
>   - drop the bulk acknowledge and only mask and acknowledge unmapped
>     vectors under the controller lock;
>   - cache GCSR_IRQMASK and dispatch from a lockless READ_ONCE() snapshot;
>   - move the per-iteration declarations into the loop scope.
> - irqchip: delegate the acknowledge to the parent irq_data with
>   MSI_CHIP_FLAG_SET_ACK, so the callback gets the right chip_data/hwirq.
> - The issue was reproduced with a dedicated MSI race test on EyeQ5
>   hardware, and the same test passes with this revision.
> - Link to v5: https://patch.msgid.link/20261125-eyeq5_msi-v5-0-72346cd10736@bootlin.com
>
> Changes in v5:
> - irqchip: fix the MSI loss. Mask the vector on disable_irq() with
>   IRQ_DISABLE_UNLAZY so the MSI stays pending in GCSR_IRQSTATUS until
>   enable_irq(). (sashiko)
> - irqchip: filter GCSR_IRQSTATUS with GCSR_IRQMASK in eyeq_msi_isr()
>   so a masked vector is not dispatched when a sibling fires. (sashiko)
> - irqchip: clear GCSR_IRQSTATUS on vector alloc and free, so a reused
>   vector does not deliver a stale MSI to its new owner.
> - irqchip: program the hardware before creating the IRQ domain, so no
>   vector can be allocated before the hardware is ready.
> - irqchip: bound the ISR loop, so a device that keeps setting a vector
>   cannot hang a CPU.
> - Link to v4: https://patch.msgid.link/20261116-eyeq5_msi-v4-0-2e1233b014b0@bootlin.com
>
> Changes in v4:
> - irqchip: use a plain raw_spinlock() in the mask/unmask callbacks, which
>   run with interrupts disabled.
> - irqchip: use guard_chained_irq() to balance the chained handler on every
>   return path.
> - irqchip: simplify the domain alloc/free callbacks now that nr_irqs is
>   always 1.
> - irqchip: reformat the MSI flag macros and use a distinct "EYEQ-P-" prefix
>   for the platform MSI parent.
> - MIPS: move the EYEQ5_MSI selection into a separate MIPS patch, out of the
>   irqchip driver patch.
> - Link to v3: https://patch.msgid.link/20261104-eyeq5_msi-v3-0-2866f732cd38@bootlin.com
>
> Changes in v3:
> - Address review comments from sashiko.
> - dt-bindings: drop the interrupt-controller, #interrupt-cells and label
>   properties.
> - irqchip: use handle_edge_irq() with an ack callback instead of
>   handle_simple_irq(), so a vector is masked while disabled and a second
>   MSI is not lost while the first is in progress. For this one, I ran
>   some tests to confirm that the issue was real (it was) and that the fix
>   resolves it.
> - irqchip: convert to a platform driver because the node is no longer an
>   interrupt controller and is no longer probed by of_irq_init().
> - irqchip: stop parsing the label property and use the node full name in
>   the boot message.
> - MIPS: dts: update the MSI nodes according to the binding changes.
> - Link to v2: https://patch.msgid.link/20261102-eyeq5_msi-v2-0-4aa3d3608064@bootlin.com
>
> Changes in v2:
> - Address review comments from Krzysztof Kozlowski, Thomas Gleixner and
>   sashiko.
> - dt-bindings: drop the num-vectors property (all ports have four
>   vectors) and simplify the example.
> - irqchip: use the fixed four-vector count, add lockdep assertions, and
>   dispatch through generic_handle_demux_domain_irq() with a redirect-based
>   irq_set_affinity() callback.
> - irqchip: drop MSI_FLAG_MULTI_PCI_MSI (standard Multi-MSI cannot work
>   with the address-based vector decoding) and MSI_FLAG_NO_AFFINITY; add
>   MSI_FLAG_PCI_MSI_MASK_PARENT.
> - irqchip: keep vectors masked during allocation, mask all vectors and
>   clear pending status before installing the chained handler, and reject
>   of_irq_get() returning 0.
> - MIPS: dts: drop the num-vectors property from both MSI nodes.
> - Reformat the driver for the 100-column limit.
> - Link to v1: https://patch.msgid.link/20261028-eyeq5_msi-v1-0-c464752fb55f@bootlin.com
>
> To: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
> To: Benoît Monin <benoit.monin@bootlin.com>
> To: Gregory CLEMENT <gregory.clement@bootlin.com>
> To: Théo Lebrun <theo.lebrun@bootlin.com>
> To: Thomas Gleixner <tglx@kernel.org>
> To: Radu Rendec <radu@rendec.net>
> To: Rob Herring <robh@kernel.org>
> To: Krzysztof Kozlowski <krzk+dt@kernel.org>
> To: Conor Dooley <conor+dt@kernel.org>
> To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: linux-mips@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: devicetree@vger.kernel.org
>
> ---
> Gregory CLEMENT (5):
>       dt-bindings: interrupt-controller: add Mobileye EyeQ5 PCIe MSI controller
>       irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver
>       MIPS: eyeq: select the EyeQ5 MSI controller
>       MIPS: dts: eyeq5: add MSI controllers
>       MAINTAINERS: add EyeQ5 MSI controller entry
>
>  .../interrupt-controller/mobileye,eyeq5-msi.yaml   |  76 ++++
>  MAINTAINERS                                        |   2 +
>  arch/mips/Kconfig                                  |   1 +
>  arch/mips/boot/dts/mobileye/eyeq5.dtsi             |  22 +
>  drivers/irqchip/Kconfig                            |   5 +
>  drivers/irqchip/Makefile                           |   1 +
>  drivers/irqchip/irq-eyeq5-msi.c                    | 465 +++++++++++++++++++++
>  7 files changed, 572 insertions(+)
> ---
> base-commit: 08b814ca0a6945b8effc1a0d64999d562f24c923
> change-id: 20261028-eyeq5_msi-86aa1d590684
>
> Best regards,
> --  
> Grégory CLEMENT, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>

-- 
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      parent reply	other threads:[~2026-12-03 16:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 15:09 [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT
2026-12-03 15:09 ` [PATCH v6 1/5] dt-bindings: interrupt-controller: add Mobileye " Gregory CLEMENT
2026-12-03 15:09 ` [PATCH v6 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver Gregory CLEMENT
2026-12-03 15:09 ` [PATCH v6 3/5] MIPS: eyeq: select the EyeQ5 MSI controller Gregory CLEMENT
2026-12-03 15:09 ` [PATCH v6 4/5] MIPS: dts: eyeq5: add MSI controllers Gregory CLEMENT
2026-12-03 15:09 ` [PATCH v6 5/5] MAINTAINERS: add EyeQ5 MSI controller entry Gregory CLEMENT
2026-12-03 16:14 ` Gregory CLEMENT [this message]

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=87cxriz6hp.fsf@BLaptop.bootlin.com \
    --to=gregory.clement@bootlin.com \
    --cc=benoit.monin@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=radu@rendec.net \
    --cc=robh@kernel.org \
    --cc=tglx@kernel.org \
    --cc=theo.lebrun@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=vladimir.kondratiev@mobileye.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