From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=121.127.44.73 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796418572; b=gk85aP8DYR4LfG6GIhcLeWwK01F+GpPDFbdgwpiYC726/9DFSPQnwNmlZcF3WWgfdvuz hMf7r84cIqgqeuv28N2rabcqKZM0Z6jxlI1RHYN8VZnwj+pr+8c+A/oEdK8iVycDajLTD MQOTFw3TIbxuj9sSa4RkjAVEjEBTK43gYiGU1+U4phgfLvsH7Y7EV1YNLR881edPtBTs7 lwqix2G4q6CaSj0I8FWA/tnJ8Z3NhpkMrSag6Aj38OBGfzyQYqBfR1uYjmjKv1l4tNNgu 1RykHRhppL5EYfv5+9PwDkO4XuNoGP04w2eZBt+dpLtb8WK6GMd2741oq8rOYKuyuWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796418572; h=DMARC-Filter:DKIM-Signature:DKIM-Signature:CFBL-Feedback-ID: CFBL-Address:X-Forward-Email-ID:X-Forward-Email-Sender: X-Forward-Email-Version:X-Forward-Email-Website:X-Complaints-To: X-Report-Abuse:X-Report-Abuse-To:Message-ID:Subject:From:To:Cc:Date: In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version; bh=gmllMwLkebNtk7MCZiwrLUWzscmVm5V9FgAHQY3PgBA=; b=P08GKLMnGO1FbsJ8/freV6n1qYUecYNoKP/BVDISmPxd3NdHCx26l3zf9hFUobW37eoU u+Fb2tcCAtwdj3Vma39H8WvIjHME9ajurZu0GF7kiFOB8zJx8apL5hEXA4kh3/pp5LQIu TFK6Pj2NbxY4LzHJWtwoFrKGLBtCImya34h+7D/YzbbEP9fceAPiAv720Q+TwPKE6OdOY dpB9VBMIqKwRIlm3xQcfb6RWdYU7THnW56Dsou5LbRkLheQoJS/l/Vbbrg4tUgT/PuZuT O+1dmYi0hNoTKGBe03jNT0ejY6Ro1yoA5T1NmxOYTWREsb23iiHFbr3nW0KEobpl/cg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=maintainer.cc; spf=pass smtp.mailfrom=fe-bounces.maintainer.cc; dkim=pass header.d=maintainer.cc header.i=@maintainer.cc header.a=rsa-sha256 header.s=fe-54a0ea1b23 header.b=ij2OTvhu; dkim=pass header.d=forwardemail.net header.i=@forwardemail.net header.a=rsa-sha256 header.s=default header.b=mMuCYBK5; arc=none smtp.remote-ip=121.127.44.73 Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.73]) (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 C7AF1606A322 for ; Fri, 4 Dec 2026 21:09:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C7AF1606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=maintainer.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fe-bounces.maintainer.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=maintainer.cc header.i=@maintainer.cc header.a=rsa-sha256 header.s=fe-54a0ea1b23 header.b=ij2OTvhu; dkim=pass (1024-bit key, unprotected) header.d=forwardemail.net header.i=@forwardemail.net header.a=rsa-sha256 header.s=default header.b=mMuCYBK5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maintainer.cc; h=MIME-Version: Content-Transfer-Encoding: Content-Type: References: In-Reply-To: Date: Cc: To: From: Subject: Message-ID: CFBL-Address: CFBL-Feedback-ID; q=dns/txt; s=fe-54a0ea1b23; t=1796418566; bh=gmllMwLkebNtk7MCZiwrLUWzscmVm5V9FgAHQY3PgBA=; b=ij2OTvhu1MV1dnzH1iJzPZKGdusNwdzshWQ0PSw9NEjHPPvh3HBqDoLsYF18o28Ercio4YBFW Dr354zYbfjH0elB48vt18CbQ1dvcP6UqdTHh3X77U0sHTQDmmbK6h7BljpvxJC2mK2UAcoa/3sL SOLu5tJCpIa2s5B5R3AhM8I= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=forwardemail.net; h=MIME-Version: Content-Transfer-Encoding: Content-Type: References: In-Reply-To: Date: Cc: To: From: Subject: Message-ID: CFBL-Address: CFBL-Feedback-ID; q=dns/txt; s=default; t=1796418566; bh=gmllMwLkebNtk7MCZiwrLUWzscmVm5V9FgAHQY3PgBA=; b=mMuCYBK5uDPDiErfizuIFh80nFk/9QXH1yyrzjqGVtyb/QbgC+sQ3z2vR/uCkj7snQzEKTw9j 4843/Esm6FsW5rmPXT3/EELV6slQua+/1GyLnnAnHOVIh+cAtXH5l2mR6DK86zLCLQwRGdUh0gb 7MANhUvoOd/Wg3HOc9tCZaw= CFBL-Feedback-ID: 6b132c02760d62debcb2c0bf:d679d64096fe4fb814bcf053234fc269 CFBL-Address: abuse@forwardemail.net; report=arf X-Forward-Email-ID: 6b132c02760d62debcb2c0bf X-Forward-Email-Sender: rfc822; lyude.paul@maintainer.cc, smtp.forwardemail.net, 121.127.44.73 X-Forward-Email-Version: 2.19.47 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Report-Abuse-To: abuse@forwardemail.net Message-ID: <08be16e64db43a44f20fb5ce2bf727787257727c.camel@maintainer.cc> Subject: Re: [PATCH v2] drm/nouveau/intr: do not unmask hardware interrupts while unarmed From: Lyude Paul To: Pufan Jin , Danilo Krummrich , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Date: Fri, 04 Dec 2026 16:09:21 -0500 In-Reply-To: <20261204113358.191974-1-cyan2254650260@gmail.com> References: <20261204113358.191974-1-cyan2254650260@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-2.fc43) 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 Reviewed-by: Lyude Paul Thanks for sending out a V2 with the additional fixes, I reverted the V1 from the drm-misc-fixes branch and will push this one in a moment. On Fri, 2026-12-04 at 19:33 +0800, Pufan Jin wrote: > During device initialization in nvkm_device_init(), nvkm_intr_rearm() > iterates through legacy subdevices and calls nvkm_intr_subdev_add(), > which calls nvkm_inth_allow() -> nvkm_intr_allow_locked(). >=20 > nvkm_intr_allow_locked() directly writes to the hardware interrupt > allow registers (e.g. PMC register 0x160 on GP100/GP10B) to unmask > the subdevice's interrupt in hardware, and nvkm_inth_allow() then > restores CPU interrupts via spin_unlock_irqrestore(). >=20 > 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(). >=20 > In nvkm_intr(), because device->intr.armed is false, the handler > bails > out early and returns IRQ_NONE without reading or clearing the > interrupt: >=20 > =C2=A0=C2=A0=C2=A0 spin_lock(&device->intr.lock); > =C2=A0=C2=A0=C2=A0 if (!device->intr.armed) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto done_unlock; >=20 > Because the level-triggered line remains continuously asserted, this > causes an immediate interrupt storm, leading the kernel to disable > the IRQ line with "nobody cared": >=20 > =C2=A0=C2=A0=C2=A0 irq 142: nobody cared (try booting with the "irqpoll" = option) > =C2=A0=C2=A0=C2=A0 handlers: > =C2=A0=C2=A0=C2=A0 [<...>] nvkm_intr [nouveau] > =C2=A0=C2=A0=C2=A0 Disabling IRQ #142 >=20 > Fix this by 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 later > program > and unmask the accumulated mask under spin_lock_irq() when arming the > device. >=20 > Fixes: 3ebd64aa3c4f ("drm/nouveau/intr: support multiple trees, and > explicit interfaces") > Signed-off-by: Pufan Jin > --- > Changes in v2: > - Drop the nvkm_intr_unarm_locked() call from the !device->intr.armed > =C2=A0 path in nvkm_intr() to avoid BAR0 MMIO accesses while suspended in > =C2=A0 D3 and racing with nvkm_intr_dtor(). > - Drop setting ret =3D IRQ_HANDLED in the unhandled-interrupt storm > =C2=A0 mitigation path so spurious IRQ detection still works on GPUs > =C2=A0 without intr->func->block (such as nv04_mc_intr). > - Add Fixes tag for commit 3ebd64aa3c4f. >=20 > =C2=A0drivers/gpu/drm/nouveau/nvkm/core/intr.c | 4 ++-- > =C2=A01 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/gpu/drm/nouveau/nvkm/core/intr.c > b/drivers/gpu/drm/nouveau/nvkm/core/intr.c > index f31aca949e..ff9f1c36f1 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 > =C2=A0nvkm_intr_allow_locked(struct nvkm_intr *intr, int leaf, u32 mask) > =C2=A0{ > =C2=A0 intr->mask[leaf] |=3D mask; > - if (intr->func->allow) { > + if (intr->subdev->device->intr.armed && intr->func->allow) { > =C2=A0 if (intr->func->reset) > =C2=A0 intr->func->reset(intr, leaf, mask); > =C2=A0 intr->func->allow(intr, leaf, mask); > @@ -120,7 +120,7 @@ static void > =C2=A0nvkm_intr_block_locked(struct nvkm_intr *intr, int leaf, u32 mask) > =C2=A0{ > =C2=A0 intr->mask[leaf] &=3D ~mask; > - if (intr->func->block) > + if (intr->subdev->device->intr.armed && intr->func->block) > =C2=A0 intr->func->block(intr, leaf, mask); > =C2=A0} > =C2=A0