From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.227.139 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795930221; b=EZX+gmhbKh3Me8qxUgnMEWJferU9VrihRFENQYzPKLf5Ss7CLxWINnObNRIQ+uho4d56 w8gcy7GN3+rZYjN7xHdS8j2C7AdXhp6Yz+//2IjcU9LwBHiAQJ2uy6wWpFAF1WOHlf58M 8nBZIT3elLxiwjQZ2zILzhpW96d9qNP2r7P16f6bdQa9Wr11UdE6q078U+2OGIhsq2HQu cysfiIw+fP6DNNrLYNtrgZmHdZk1apOiOQ3/aCt8ks2j9d6Dazfvr2CRgi2c5DnuAcIbN dF5Prp4dwn+xeQYyaEc8VDhafgzga4tiu5R81FjtnpuOwjEv2mSZDHTFH6Z5jD7l0GQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795930221; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=IWCQefgF3C0dqW0GrC5nlMJQqORgP8aj0vRQq4BIZyo=; b=Z5UbrV6U879v1x6r3ptSZAS8srEepfhK8zDUH67FAt/WuaFJldzI4nTNAPJPA2zE+wZX Ubzsr5ylU9EEhTPY5OEaAF/IifbLluxOivsG+nXpwIsgwwka9j+KUq8ILAaEkzxy5grDE HAOm7mGTZ3u6Fv3xVbltQM3tuVLRC40uWxB1w71km7VoHDdoyPmfxIxQ5uqHrQA5rPb1j oaJqZe/b1YBv66okCgB+Sh2PTywp2m55NGaVxDNa3oVDCuLiRhVzKp4RZuHzWGbkxFyzj Vxkd0kOYktLUsm3ESASn8mrtMeNdoNqhemBxpiXwdOg4b+e1184dvFJz2GN6eHaAF2w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=H4M9G3iG; arc=none smtp.remote-ip=74.125.227.139 Received: from mail-pj2-f11.google.com (mail-pj2-f11.google.com [74.125.227.139]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EF90606A31C for ; Sun, 29 Nov 2026 05:30:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2EF90606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=H4M9G3iG Received: by mail-pj2-f11.google.com with SMTP id d9443c01a7336-2f14313e64eso622945ad.0 for ; Sat, 28 Nov 2026 21:30:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795930220; x=1796535020; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=IWCQefgF3C0dqW0GrC5nlMJQqORgP8aj0vRQq4BIZyo=; b=H4M9G3iGbxX4ihJahyBfK8KNdKXr+hqz8yVW/JwNycIc63OAQ8ECqVq5+Cj3qq2vcC JWeF3cJtAjUih+Olj2fiY+sTEh12YyRkW76cwoSEqaSzI6XKCwvJNQhTcrMaUCn1kNzL 2BDA1lOsRuM6I3IVho3YzUyfD6HX1hjCzPRqU7MW5stTXDfFRdBBssUCIoB4spWugyXP UjJ/PvT9FqR+zT3tJ53YSEEUtRTnHMTmxfADE54ID3Kjq7Ouqk7dpYiBJmylbGPvc5OI xt99dHnp5YvhHzqfegeVCxLB9Fjyksjl68Z+mW35wWJMQOn0tLuNXWNrhMVBJjqt1XCf 13Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795930220; x=1796535020; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=IWCQefgF3C0dqW0GrC5nlMJQqORgP8aj0vRQq4BIZyo=; b=LR8JBbynZIEa8+04mHGHwU2BRIQ8A135Y2cUX99ABmy0sTFOdCNbdtEtE58NaEf3wD n/YRyVb39HCOUtSBBLkq3df+CKpJBLFQGuRqmFHinkpwPc5yfAkkJByObCFZjvFm5+nN j5mTuM17uG3DExtFOKhIsWmu7FkodAxfkf7vCJPBkX5/HB6BLvEmgBLCHoZX+SJILFSg /eaB3ELQZR2jOb1n4y3aj4Qtn2KkAnFluY/mMslWkQ3Am5s9UHlWJIBIzI4XjhYxCDNr jLRl6CFIDuKfCaJWoWzsEZD5vkd/BWO2MlS3klZ7G3ymU5mNdg1jVN6TczxKym24S/oe VKfg== X-Forwarded-Encrypted: i=1; AL+hErH5dg+TbStTYqk2pEkVIcmjIMZ1IstmI1ET8l6oyVYdEsxdRGqW7cHuGBo8cQbYttH0KrXVVLaUqqtDTps=@vger.kernel.org X-Gm-Message-State: APuU4Z8Og56mp2GaUzBY2k+bWR9ahvnIULj/wwj55i4uNnZDUyRqWviR ymXu7M7zSthne0lDfoGzOK/NFQHCiec3CsakdX9pjd6PP4t4G3qEBEYQ X-Gm-Gg: AZFdTZfkaH9BpfqeIC9Mw836S4/4p+wIXjbjf2/fQWn5Wyh+dH9qqzLN7xbUxX58xG4 F4lONeyi5WbHg8GC098Fte6ERwVtQfldE/4FVbFFdn450yTAQaSYwMsUERVDkXftKX7v7+fm47o cGehwxIdR0Ptstu7imp+ItMewrdAWxmKW7kzbSY/HNSX49cSwS+TNm7Y/sJh6PRq0k5cwATVJLq 734x9zhfPOt9ao8gN+F03+Kmt2yg9I3UbIqYwJlDbfMY4ySR9+fQnXAVj9K9r235tQf0bUY3d6J 3cAFyuWWFIlnArnHDsYiq6CjXBPkT5dLEVAtPQAConBNdq7eNg4D+gYlF4hgUlZLFs7bL+QuZX4 j/JVB+aGbfw413VT6fSb8Fowam7Pe27wAjz0KdTmVYhOr/3CihoZITjUO46/ZhEU58dRKL05Hxn QGZ7B2rtVH0/H/YUVKef5YOfBTsUIn6Jo4hyRXmIMgFBC1HPDm0xLCvjiOqGrNC4KfW/wziqkfc ue8ONzhABbrnlIgsBlgpFgBAR1S5xSxg5RQ4lLDYAxiztu576bH7xREOhuELUZnF2aYCbyb93eG uPabVIx+wdJy8bDIPTEbXHsb6Lks1XhmUWB+JcQKbE174Z4= X-Received: by 2002:a17:902:ea0c:b0:2f0:3123:899c with SMTP id d9443c01a7336-2f03f0c1f37mr287938635ad.5.1795930220102; Sat, 28 Nov 2026 21:30:20 -0800 (PST) Received: from AERO17.orionisli.com ([64.118.142.212]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f03f0c1a8asm143959965ad.24.2026.11.28.21.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Nov 2026 21:30:19 -0800 (PST) From: Pufan Jin To: Danilo Krummrich , David Airlie , Lyude Paul , Maarten Lankhorst , Maxime Ripard , Simona Vetter , Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org Subject: [PATCH] drm/nouveau/intr: do not unmask hardware interrupts while unarmed Date: Sun, 29 Nov 2026 13:30:08 +0800 Message-ID: <20261129053008.70733-1-cyan2254650260@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit During device initialization in nvkm_device_init(), nvkm_intr_rearm() iterates through all legacy subdevices and calls nvkm_intr_subdev_add(), which in turn calls nvkm_inth_allow() -> nvkm_intr_allow_locked(). nvkm_intr_allow_locked() directly writes to the hardware interrupt enable registers (e.g. PMC register 0x160 on GP100/GP10B) to unmask the subdevice's interrupt, and nvkm_inth_allow() then restores local CPU interrupts via spin_unlock_irqrestore(). However, at this point, device->intr.armed is still false because arming is performed only at the end of nvkm_intr_rearm(). On platforms where the GPU interrupt is level-triggered and directly wired to an interrupt controller (such as Tegra GP10B using GIC SPI 70), any pending interrupt assertion immediately triggers the top-level interrupt handler nvkm_intr(). In nvkm_intr(), because device->intr.armed is false, the handler bails out early and returns IRQ_NONE without reading, acknowledging, or masking the interrupt source: spin_lock(&device->intr.lock); if (!device->intr.armed) goto done_unlock; Because the interrupt line remains continuously asserted, this causes an immediate, tight interrupt storm (100,000 unhandled interrupts), leading the kernel to disable the IRQ line with "nobody cared": irq 142: nobody cared (try booting with the "irqpoll" option) CPU: 0 UID: 0 PID: 361 Comm: (udev-worker) Hardware name: NVIDIA Jetson TX2 Developer Kit (DT) Call trace: ... handle_fasteoi_irq+0xe0/0x180 gic_handle_irq+0x3c/0xc0 _raw_spin_unlock_irqrestore+0x18/0x40 (P) nvkm_intr_subdev_add_dev+0x6c/0x88 [nouveau] nvkm_intr_rearm+0x138/0x1f8 [nouveau] nvkm_device_init+0x118/0x290 [nouveau] handlers: [<...>] nvkm_intr [nouveau] Disabling IRQ #142 Fix this issue by: 1. Only writing to the hardware allow/block registers in nvkm_intr_allow_locked() and nvkm_intr_block_locked() when device->intr.armed is true. While unarmed, only the software interest mask (intr->mask) is updated, and nvkm_intr_rearm() will program the accumulated mask under spin_lock_irq() when arming the device. 2. If an unexpected interrupt arrives while unarmed, explicitly calling nvkm_intr_unarm_locked() in nvkm_intr() to silence top-level interrupt generation immediately. 3. Marking ret = IRQ_HANDLED when unhandled interrupts are blocked by the IRQ storm mitigation logic in nvkm_intr(). Signed-off-by: Pufan Jin --- drivers/gpu/drm/nouveau/nvkm/core/intr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/core/intr.c b/drivers/gpu/drm/nouveau/nvkm/core/intr.c index f31aca949..0397a630a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/intr.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/intr.c @@ -91,7 +91,7 @@ static void nvkm_intr_allow_locked(struct nvkm_intr *intr, int leaf, u32 mask) { intr->mask[leaf] |= mask; - if (intr->func->allow) { + if (intr->subdev->device->intr.armed && intr->func->allow) { if (intr->func->reset) intr->func->reset(intr, leaf, mask); intr->func->allow(intr, leaf, mask); @@ -120,7 +120,7 @@ static void nvkm_intr_block_locked(struct nvkm_intr *intr, int leaf, u32 mask) { intr->mask[leaf] &= ~mask; - if (intr->func->block) + if (intr->subdev->device->intr.armed && intr->func->block) intr->func->block(intr, leaf, mask); } @@ -172,8 +172,10 @@ nvkm_intr(int irq, void *arg) /* Disable all top-level interrupt sources, and re-arm MSI interrupts. */ spin_lock(&device->intr.lock); - if (!device->intr.armed) + if (!device->intr.armed) { + nvkm_intr_unarm_locked(device); goto done_unlock; + } nvkm_intr_unarm_locked(device); nvkm_pci_msi_rearm(device); @@ -215,6 +217,7 @@ nvkm_intr(int irq, void *arg) nvkm_debug(intr->subdev, "intr%d: %08x\n", leaf, intr->stat[leaf]); nvkm_intr_block_locked(intr, leaf, intr->stat[leaf]); + ret = IRQ_HANDLED; } } } -- 2.56.1