From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.231.198 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796366315; b=m3E9JVJaUGLDuunKfgZ2fQX7wfRGh73DT9bA+rxOQZpORrxkeLc1RVsm/Jyg1urw4h6D hhX5vbkco72wogXbeZAbfS2hUR+uop8HjUoT714M3AqdxE/YcK0sFpRPpmCnAtcyNs6uc ZomTh8axcQTrhg90auFHer8hNLR2gr/zrkJ9iWrWGQXWGainyyH2MtjMHbMcZoTq3OzNQ tnF+WsuQzGFOwVUkCXlLmCTCyUL5HVo35gk+HlBoa5CTHIbfHqwaE3Diz/pwvXpBybrjt oFFhBbem7bDgsNUa4p5vkoDAeiZkjsQJUZ7Ljxz953hoYIgPBaD64iqsJzoK+NxRjWg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796366315; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=HFyiS/rz0OPLFjeawl68HeDWFiOa2NOC5c0NKMe6KU0=; b=UwJkvHUVM8fN14366XeaM2wf2m+6Bz2Wvxl0v3kZ5GT6wHI2Gz5b+yrfOFHsZxTyu+q0 ccgZ/CGR8X5f3bEBLvr0suWUNpTJhKOGRWfgKCP/zfudCQMTV7yc6lljOPqP/5qKl564V MQPxQ2KfrRIybtojRe8BRywYNDuk/1pAOCNiGCc04M2PiJDuPnj+f4JLnf8E0u56mbZ5B 8eeUBAV1b4kd3Y2FSBEDXvTDIKI15JKR4fEv6pVEZmFFGoxiRFOYdeF4Zrxa5d0wJCP+A ekXLGASwVycWOLNU8lNxMEmYoDq1B7/RSpzQfH+56B3vl2THea209kjAF2xWPkTChhw== 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="uIWZ/2Na"; arc=none smtp.remote-ip=74.125.231.198 Received: from mail-oi2-f6.google.com (mail-oi2-f6.google.com [74.125.231.198]) (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 13244606A32C for ; Fri, 4 Dec 2026 06:38:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 13244606A32C 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=uIWZ/2Na Received: by mail-oi2-f6.google.com with SMTP id 5614622812f47-550f311b527so309069b6e.1 for ; Thu, 03 Dec 2026 22:38:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796366314; x=1796971114; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=HFyiS/rz0OPLFjeawl68HeDWFiOa2NOC5c0NKMe6KU0=; b=uIWZ/2NaTSoqBycD/KeMkFSVxad4e5dMciOrqekMXfTLWg2x67v/WWf1HP/cvgOmdC dy36ngEODCSdJuHMwLWo9DvqrTtvPGYHV88baIO3segTbbd414WpLjDE39jBxU5xOQxZ KSwJWZTFvYMguiDMUdNSrWcUMg+BrR34XLzBsPzJvBbByJTgD1jkGMPQswom/+Jm8ico QvMXiD9ardfS1OQZl4GDVsq4jT6Ii3QVvyiy7XymM+PzF5wBGGoF16LsC+wnqcpRXBmF po0ooJk0KURv/lemFXEs+fw5DPDXXdylv3RPSGVPdkt84PP6nstcPmkzQs5uvtF5aqcH 0a4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796366314; x=1796971114; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HFyiS/rz0OPLFjeawl68HeDWFiOa2NOC5c0NKMe6KU0=; b=LmnKRuWWvsVyVcXFD9dEyqVpkjlojgyQ+bElY2s728GsESg/OhvgGQobSR8LSXRwrb vKtTBeQQl7r4E9UzpQeU/4AB2ocMXjxqeD78ctS0ZNnMdOxC+64VLpLtIZfRHnM8yuQ7 kvmlm+iZpW8UbBI10ncAaiP6UWAP0/RbgqIzZischYvLoT4W7gAepyC5tSsBHcGMK4LS CrDyfZLZG7jkUGl6FFYzy18WXL6VaSKBJePNCgKxJ5efyF/FVsjwRD4VEY/mjj4FXwon zBYypkwd7g5j93YFGkbQnt/w9+3KxaP9s/JK4zRS2kmassLvtAWL1YPIR9y4cMNj2GVF xlJw== X-Forwarded-Encrypted: i=1; AL+hErEZsa37zGdLKxozunZx/DCxCZVV70KaHoJuaSejRPJM5/avGllRUIul01kmk0ZTT47X6LXhhCJbMJR4yTk=@vger.kernel.org X-Gm-Message-State: APuU4Z/8TbLNKYbc0kiHQZ1YCc1/nnJNxHxzf6xWBxkN4PG20UxewgA9 jtBFy7EdCPf28F3xLlcmXlIsD8p3+/12Mc5pYlPmMF8WidX3LdDppfO0 X-Gm-Gg: AZFdTZf+mzESnNhnNRE7zvhTsuNZWX2oN3vVMeVPrfx0tRI8eU1KkQJUnNFJDpTIjVd 7UXv3MYB2boWjOJ77J2JqxHjbxX4N6DaLvi8d7+AmRdgP2X0hVR+uMmqEf+Pov1rQjaNMRlG7fa PyUwagMjUFLq5I2kTxfB2LDgRQJZ0VnTy6bfwmEUXcuafQ6vNt702RonNypblnT9CCZ3vn+1oQb khKjstq1oaYazZzpCnhoeYlalWS0qfhs8dVgbQLfmMgsevA9dPZ2jaapUpcov4LgixPdiL1GOOC CvefmSKRRrx5ZW6g5uzb8ILWd7km3lx26LYYXJwC/JnCGA8CJAXYxrrblvODcytMGgl5WVZMwiP EbjLPtUMbLxMKKrP6ar44PB0sb9F3YqrvXjRhCSJIk6pWS7W2JJl5Hkb+aAacFoc/bY9KkU4GW7 jS9EQZuUbOhUMIxIcPIgcUcgfhWMqDxvaLtHyjCMBnZmDaFgrGhD3bQMKLGfyR8oXuL01SpJWna lH79I5m6LM1F4xwuUd6YL9EvuB1NPOHv1GV1ow6bf+x3GDInBRqQOd/x3v3393sXBdRvZTHw1cA eJyemzCG6QJRetypOODO6khl2lE7Gtr/ X-Received: by 2002:a05:6808:4f65:b0:503:8f9d:f11b with SMTP id 5614622812f47-57f20831665mr1159128b6e.43.1796366313866; Thu, 03 Dec 2026 22:38:33 -0800 (PST) Received: from [198.18.0.1] ([2604:a00:101:c:216:3eff:fe2e:ad51]) by smtp.gmail.com with ESMTPSA id 5614622812f47-57f1f6ae158sm966683b6e.10.2026.12.03.22.38.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2026 22:38:33 -0800 (PST) Message-ID: Date: Fri, 4 Dec 2026 14:38:27 +0800 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/nouveau/intr: do not unmask hardware interrupts while unarmed To: Lyude Paul , Danilo Krummrich , David Airlie , Maarten Lankhorst , Maxime Ripard , Simona Vetter , Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org References: <20261129053008.70733-1-cyan2254650260@gmail.com> Content-Language: en-US From: Pufan Jin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Lyude, Thanks for taking a look! If you haven't pushed this yet, could you hold off on v1 for a moment? After sending it, it turned out that the two extra changes in nvkm_intr() actually have some issues (flagged by the Sashiko bot): calling nvkm_intr_unarm_locked() when !device->intr.armed can hit BAR0 MMIO on a shared IRQ while the GPU is suspended in D3, and can also race with nvkm_intr_dtor(). And returning IRQ_HANDLED in the storm path would defeat spurious IRQ detection on older cards that don't have a .block callback. Neither of those two hunks is actually needed to fix the TX2 IRQ storm anyway. Only guarding the allow/block register writes on device->intr.armed is enough, and I should add a Fixes tag too. I'll test the trimmed-down v2 on my TX2 and send it out soon. If v1 already went in, no problem at all, I can just send a follow-up patch to revert those two bits. Thanks, Pufan On 12/4/26 10:05 AM, Lyude Paul wrote: > Reviewed-by: Lyude Paul > > Will push to drm-misc-fixes in a bit > > On Sun, 2026-11-29 at 13:30 +0800, Pufan Jin wrote: >> 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; >>   } >>   } >>   }