From: sashiko-bot@kernel.org
To: "Gregory CLEMENT" <gregory.clement@bootlin.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver
Date: Thu, 03 Dec 2026 15:51:48 +0000 [thread overview]
Message-ID: <sashiko-outbox-248152@kernel.org> (raw)
In-Reply-To: <20261203-eyeq5_msi-v6-2-8ffe74494bd2@bootlin.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] irqchip/eyeq5-msi: missing irq_pre_redirect causes SMP parent
IRQ storm
- [Medium] irqchip/eyeq5-msi: TOCTOU race in eyeq_msi_isr() masks
reallocated vector
- [Medium] irqchip: unnecessary spinlock in eyeq_msi_ack_irq() hot path
- [Low] irqchip: eyeq_msi_probe() keeps unmanaged of_iomap() despite v4
review
--
commit b06bebb42809e988f802666b3d556a924b893597
Author: Gregory CLEMENT <gregory.clement@bootlin.com>
irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver
This commit adds the EyeQ5 PCIe MSI controller driver, supporting up to
4 vectors per port in either root complex (PCI MSI parent) or endpoint
(platform MSI parent) mode chained to a parent GIC interrupt.
> diff --git a/drivers/irqchip/irq-eyeq5-msi.c b/drivers/irqchip/irq-eyeq5-msi.c
> new file mode 100644
> index 0000000000000..3d50f13d7c9dd
> --- /dev/null
> +++ b/drivers/irqchip/irq-eyeq5-msi.c
> @@ -0,0 +1,465 @@
[ ... ]
> +static void eyeq_msi_ack_irq(struct irq_data *data)
> +{
> + struct eyeq_msi *msi = irq_data_get_irq_chip_data(data);
> +
> + if (irqd_irq_disabled(data))
> + return;
> +
> + guard(raw_spinlock)(&msi->lock);
> + __eyeq_msi_ack_irq(msi, data->hwirq);
> +}
[Severity: Medium]
Does eyeq_msi_ack_irq() need to take msi->lock on every handled MSI?
__eyeq_msi_ack_irq() only does a single-bit write-one-to-clear writew() to
GCSR_IRQSTATUS without touching msi->mask_cache or msi->used. Same-vector
serialization with disable, mask, and unmask is already handled by
desc->lock, and distinct status bits are independent in hardware.
Acquiring the controller-wide spinlock on every interrupt serializes all
four vectors and dirties the cacheline holding struct eyeq_msi (including
msi_domain, gcsr_base, and mask_cache read by eyeq_msi_isr()) on remote
CPUs. Dropping msi->lock here avoids that contention and false sharing.
> +
> +static struct irq_chip eyeq_msi_irq_chip = {
> + .name = "EyeQ5-MSI",
> + .irq_mask = eyeq_msi_mask_irq,
> + .irq_unmask = eyeq_msi_unmask_irq,
> + .irq_ack = eyeq_msi_ack_irq,
> + .irq_compose_msi_msg = eyeq_msi_compose_msg,
> +#ifdef CONFIG_SMP
> + .irq_set_affinity = irq_chip_redirect_set_affinity,
> +#endif
> +};
[Severity: High]
As reported by Thomas Gleixner on v5 [1], can omitting irq_pre_redirect on
eyeq_msi_irq_chip cause a level-triggered parent GIC IRQ storm on SMP?
When a vector is steered to another CPU, demux_redirect_remote() queues
redirect work and returns true without calling eyeq_msi_ack_irq().
GCSR_IRQSTATUS stays asserted, so eyeq_msi_isr() spins through
EYEQ_MSI_MAX_DRAIN and the parent GIC IRQ storms until target_cpu runs it.
If desc->action is NULL when demux_redirect_remote() runs, no work is
queued and the parent CPU locks up permanently. Also, __free_irq() clears
IRQ_DISABLE_UNLAZY from eyeq_msi_domain_alloc(), so after a free/request
cycle a disabled redirected vector is left unmasked.
Implementing irq_pre_redirect() to ack active vectors and mask disabled
ones in parent ISR context, and wiring irq_chip_pre_redirect_parent in a
custom init_dev_msi_info callback (since msi_lib_init_dev_msi_info() does
not set it), would address this.
[ ... ]
> + for_each_set_bit(bit, &pending, EYEQ_MSI_MAX_VECTORS) {
> + if (generic_handle_demux_domain_irq(msi->msi_domain, bit))
> + continue;
> +
> + /* Silence an interrupt for an unmapped vector. */
> + guard(raw_spinlock)(&msi->lock);
> + __eyeq_msi_mask_irq(msi, bit);
> + __eyeq_msi_ack_irq(msi, bit);
> + }
[Severity: Medium]
Can this unmapped-vector fallback mask a vector that has just been
reallocated and enabled on another CPU?
irq_domain_free_irqs() removes the revmap entry and frees the bit in
msi->used without waiting for an RCU grace period, so another CPU can
reallocate and unmask the same vector before eyeq_msi_isr() takes
msi->lock:
CPU0 CPU1
eyeq_msi_isr()
readw(GCSR_IRQSTATUS)
irq_domain_free_irqs()
irq_domain_remove_irq()
eyeq_msi_domain_free()
generic_handle_demux_domain_irq()
-> returns false (unmapped)
eyeq_msi_domain_alloc()
set_bit(bit, msi->used)
request_irq()
eyeq_msi_unmask_irq()
guard(raw_spinlock)(&msi->lock)
__eyeq_msi_mask_irq(msi, bit) <-- masks newly enabled vector
__eyeq_msi_ack_irq(msi, bit)
This leaves the new owner's vector masked in GCSR_IRQMASK and
msi->mask_cache while irq_desc still considers it unmasked, silencing
future interrupts. Checking !test_bit(bit, msi->used) under msi->lock
before masking and acking avoids clobbering the new owner.
[ ... ]
> + msi->gcsr_base = of_iomap(node, 0);
> + if (!msi->gcsr_base) {
> + pr_err("failed to map GCSR registers\n");
> + return -ENOMEM;
> + }
> +
> + msi->msi_base = of_iomap(node, 1);
> + if (!msi->msi_base) {
> + pr_err("failed to map MSI registers\n");
> + ret = -ENOMEM;
> + goto err_unmap_gcsr;
> + }
[Severity: Low]
As reported by Thomas Gleixner on v4 [2], could both of_iomap() calls use
devm_of_iomap() (or devm_platform_ioremap_resource()) instead? That
reserves the I/O resources and removes the manual err_unmap_msi and
err_unmap_gcsr iounmap() paths (switching the error checks to IS_ERR()).
[1] https://lore.kernel.org/r/87jylsq3lz.ffs@fw13
[2] https://lore.kernel.org/r/87y0a9ox94.ffs@fw13
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-eyeq5_msi-v6-0-8ffe74494bd2@bootlin.com?part=2
next prev parent reply other threads:[~2026-12-03 15:51 UTC|newest]
Thread overview: 10+ 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:51 ` sashiko-bot [this message]
2026-12-03 15:09 ` [PATCH v6 3/5] MIPS: eyeq: select the EyeQ5 MSI controller Gregory CLEMENT
2026-12-03 15:33 ` sashiko-bot
2026-12-03 15:09 ` [PATCH v6 4/5] MIPS: dts: eyeq5: add MSI controllers Gregory CLEMENT
2026-12-03 15:28 ` sashiko-bot
2026-12-03 15:09 ` [PATCH v6 5/5] MAINTAINERS: add EyeQ5 MSI controller entry Gregory CLEMENT
2026-12-03 16:14 ` [PATCH v6 0/5] irqchip: add EyeQ5 PCIe MSI controller Gregory CLEMENT
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=sashiko-outbox-248152@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregory.clement@bootlin.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.