From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796313108; b=O6EKXmN/imuUcJGZfZhJITi8DDHas8P74pe1eI2tQ6EIZZsWif1vvUPIKukJCwpWG+Ku n2j5TPLx5i4oFFRANt/7+MFCwy5Zsh3EIDV4neQFOrAaMJg2w9s4SInh/5HcLXUpnIvAj YhgwRRt4uVEsJsHrbBPvTalB8tkmGRFpyOI70RUAKECUFme+BTdS9oozDDXAba+XMtdKW l5LtM9dZf48dEMjJotw6z5H4kIXc1oVy46StP3ny2XHIiFUJr6k9OALoS3FogPwSi6/Ui 0tSQe0oGFPn3uFyWUOWMLzQTWLA3WUnwNyD1luFzXK3Vjn1Q3xtuPwZ1bHGmE8ItRPQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796313108; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=c4x4f6SxSYWVKicTTVoBstVH2nXmerAn/QJkeibBvdE=; b=HUhj5s7wiAtVQw7KrZTilDxqjn44eCOMSShlVaSBGQj9FhxGyFZUVNb/kwQQ6l38u6PJ ZGchvqCtiQAW89MhDLEsBcc/LcxJWIjdr7GEqNop2UKI+WOn6mWJzryiWqjEpjPNFX2wF k8RUTCEiMARoiUnkpRllz4pFTRe8Kb9fb+x5Pd0b9QAKKs/vyT7gcpESTf6yZiEbpdJsH rhw+Nf3/wnQhg3MJUG4ZFXXvTw8lUA7PD+QnWxUOK8ZB1UTmHPIbuKIjXTB43C43RV8m2 gBRWham4mvcp5jC54m0syPwl85+BnM5EQlzmeELFVImbjoGajb10i/G3U2B4kgKKqDA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NsXOEDNt; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB5FE606A334 for ; Thu, 3 Dec 2026 15:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NsXOEDNt Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F6EC1F0089A; Thu, 3 Dec 2026 15:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796313108; bh=c4x4f6SxSYWVKicTTVoBstVH2nXmerAn/QJkeibBvdE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=NsXOEDNt5Ntzkz4trhnxM/VuR2q3lSSbUJwRf+79M1M1HMG8RdXVvIUxYehLC+4br Kxtjbs7z0HcjS2gXl3a6ixSNHVOAAMYNylDG3+Ob8ZGaj2Orxi7UsT76xL0O7Qpfdo Ksv7N+NS7/J0Uxxqi6h/kSSlRURscy7bPu4ypYKE3MSpfSPXBYAy9jqYdAKftsL7fZ BH4w6D2w2HsHWkg9iGOruM/NEo50Ew+S1CRUNMaTjBPUbNLwgTdy9ZGatGvkSnci7P /qhkZjWsxcdq4fOrVU91vmLVEZWFqU8JCDqk9FP7lqAfbj6WQXOSo/+Qd4kqyiKUjn 04l6ZDmyLXoBQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v6 2/5] irqchip: irq-eyeq5-msi: add EyeQ5 PCIe MSI controller driver Reply-To: sashiko-reviews@lists.linux.dev To: "Gregory CLEMENT" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261203-eyeq5_msi-v6-2-8ffe74494bd2@bootlin.com> References: <20261203-eyeq5_msi-v6-0-8ffe74494bd2@bootlin.com> <20261203-eyeq5_msi-v6-2-8ffe74494bd2@bootlin.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 15:51:48 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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 =3D 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 =3D { > + .name =3D "EyeQ5-MSI", > + .irq_mask =3D eyeq_msi_mask_irq, > + .irq_unmask =3D eyeq_msi_unmask_irq, > + .irq_ack =3D eyeq_msi_ack_irq, > + .irq_compose_msi_msg =3D eyeq_msi_compose_msg, > +#ifdef CONFIG_SMP > + .irq_set_affinity =3D 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 =3D of_iomap(node, 0); > + if (!msi->gcsr_base) { > + pr_err("failed to map GCSR registers\n"); > + return -ENOMEM; > + } > + > + msi->msi_base =3D of_iomap(node, 1); > + if (!msi->msi_base) { > + pr_err("failed to map MSI registers\n"); > + ret =3D -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 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-eyeq5_msi-= v6-0-8ffe74494bd2@bootlin.com?part=3D2