From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.246.85.4 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796314474; b=HRrC3wyZbAUooU9tH3C+UZGS5yE/WAg9gmXpopjWdeDL3bm59c79gOu9srWU2ZK/pXtQ Uwo9605qiSdcv7ODK/2rwoakoWOwzEmYPNoIv1109NxueDiNpz14/Q+eZReD37TPtJfEz cu0M3YLf3ypQf7Tfw62CCQ37cDXyeczb0EGoF+frzH10gnUxMUNe+8r5Sm8PyRCf19r6I h7D/cM99sqciGlUaBcj4osACXZzJ+JFRxyY6GlF5M7Qd6WQfwVRaT1z/jU5MDk9s1Zhsh GJKRwML+DwI2JgpEJG4EHpJymmvjzitjYlKaQ70wc1n7ro3Qz0GFqU1F0JfrtaNhJZg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796314474; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:From:To:Cc: Subject:In-Reply-To:References:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=BoFekpuc89hHkU+TpStxaznDC4v/79xJZgH3ZpxoFN8=; b=TgrnPojhwNcADJyNeNIVlLcYmaCOG9QYY4SLjzq2yec84XJgxoHf6N8z/WDOwNiLMXbx S+qfUDXt2EDXdFWojiSnEvwLC+xQJmSRtxwBkmtsBzKmPTSCuDTQcIMFK7NOw+XzXR3N7 7XKm1IaavzYhXLLriAWlHsld5vIVIVd36/8ZOz9UzFK+jbYM3W+LhvmJOUBWxFfcRy/Xj OmWYmFbzHd63b7dxmsXkZImFpevmWFP5wLhfeJU+IGB8XaRj2zUwM2y6W52SWACVTCoBv uR9sv5xN25c9Obh5v4AFrCl6pWWkJeSoVRyMKYAVF4ePZSXTltiZbS/Sn4zycoVErPQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b="me/SQhpi"; arc=none smtp.remote-ip=185.246.85.4 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97211606A32C; Thu, 3 Dec 2026 16:14:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 97211606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=me/SQhpi Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 492434E4186C; Thu, 3 Dec 2026 16:14:32 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 14968604C0; Thu, 3 Dec 2026 16:14:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9F5DE11EA18B7; Thu, 03 Dec 2026 17:14:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796314470; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=BoFekpuc89hHkU+TpStxaznDC4v/79xJZgH3ZpxoFN8=; b=me/SQhpihFKD1B478YwVYI1e9I/E3v0m92h7FAw7IvPrYMQ8vtrSVZbgGVfyOmnYDl54Hw J8ZOQn/zsMQElF30VzSLOvMPRilPV9p8PM5AodaMhjZGhM8gTYudMSu5/CYD8j45jVyaBf 4f/yxPWwEdcZvo8sjBR5vEJTgi8Vy6dZXcf/uUgABpcfCy+Sr+39AznXTNBIi5dyh/xVo1 u0PK0YHW4YQfEUe9qiGUJkhZZpSKB4su5K1ZdW3Qro2bZ+AM4WSznUuGkWJu+E/V8aYRsQ aIBqW13d2//EPMGokUerVJ8cOsXQFCCmoJHgK/2YWeiZVomHUfS3rJ7NCwYtUw== From: Gregory CLEMENT To: Vladimir Kondratiev , =?utf-8?Q?Beno?= =?utf-8?Q?=C3=AEt?= Monin , =?utf-8?Q?Th=C3=A9o?= Lebrun , Thomas Gleixner , Radu Rendec , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer Cc: Thomas Petazzoni , 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 In-Reply-To: <20261203-eyeq5_msi-v6-0-8ffe74494bd2@bootlin.com> References: <20261203-eyeq5_msi-v6-0-8ffe74494bd2@bootlin.com> Date: Thu, 03 Dec 2026 17:14:26 +0100 Message-ID: <87cxriz6hp.fsf@BLaptop.bootlin.com> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 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=C3=A9gory > > Gr=C3=A9gory > > Signed-off-by: Gregory CLEMENT > --- > 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-72346cd107= 36@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-2e1233b014= b0@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-" pref= ix > for the platform MSI parent. > - MIPS: move the EYEQ5_MSI selection into a separate MIPS patch, out of t= he > irqchip driver patch. > - Link to v3: https://patch.msgid.link/20261104-eyeq5_msi-v3-0-2866f732cd= 38@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-4aa3d36080= 64@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-c464752fb5= 5f@bootlin.com > > To: Vladimir Kondratiev > To: Beno=C3=AEt Monin > To: Gregory CLEMENT > To: Th=C3=A9o Lebrun > To: Thomas Gleixner > To: Radu Rendec > To: Rob Herring > To: Krzysztof Kozlowski > To: Conor Dooley > To: Thomas Bogendoerfer > Cc: Thomas Petazzoni > 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 cont= roller > 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, > --=20=20 > Gr=C3=A9gory CLEMENT, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com > --=20 Gr=C3=A9gory CLEMENT, Bootlin Embedded Linux and Kernel engineering https://bootlin.com