From: sashiko-bot@kernel.org
To: "Frédéric Mahé" <frederic.mahe@cirad.fr>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/nouveau/fifo/gf100-: reset the faulting engine even if it switched channels
Date: Thu, 26 Nov 2026 18:11:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-235999@kernel.org> (raw)
In-Reply-To: <20261126175531.916097-1-frederic.mahe@cirad.fr>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/nouveau/fifo: unsynchronized engn->rc_reset in
gf100_fifo_mmu_fault_recover()
--
commit c25dc87b435d54f44150db91d3c558d0942a3224
Author: Frédéric Mahé <frederic.mahe@cirad.fr>
drm/nouveau/fifo/gf100-: reset the faulting engine even if it switched channels
This commit records when an engine reports an MMU fault in engn->rc_reset
and resets that engine during runlist recovery even if its current context
no longer points to the faulting channel group.
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
> index e4a4fad2eafce..4f221c0b23fa6 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
> @@ -597,9 +597,16 @@ gf100_fifo_mmu_fault_recover(struct nvkm_fifo *fifo, struct nvkm_fault_data *inf
> info->reason, er ? er->name : "",
> chan ? chan->id : -1, info->inst, chan ? chan->name : "unknown");
>
> - /* Handle host/engine faults. */
> - if (chan)
> + /* Handle host/engine faults. The engine that reported the fault must
> + * be reset even if it has already switched to another channel (its
> + * status then no longer points at the faulting channel), otherwise it
> + * stays stalled and the runlist update never completes.
> + */
> + if (chan) {
> + if (engine)
> + atomic_set(&engn->rc_reset, 1);
> nvkm_runl_rc_cgrp(chan->cgrp);
> + }
>
> nvkm_chan_put(&chan, flags);
> }
[Severity: High]
Can setting engn->rc_reset before nvkm_runl_rc_cgrp() leave a stale
rc_reset flag armed when cgrp->rc has already left NVKM_CGRP_RC_NONE?
nvkm_runl_rc_cgrp() only schedules recovery when cgrp->rc transitions from
NVKM_CGRP_RC_NONE to NVKM_CGRP_RC_PENDING, and cgrp->rc stays at
NVKM_CGRP_RC_RUNNING once recovery starts while the channel remains in
runl->chid until userspace closes it. If a faulting channel generates
more than one MMU fault entry (for example, multiple fault buffer entries
drained by gv100_fault_buffer_process() or a second fault interrupt before
the engine is reset), the second call sets engn->rc_reset = 1 while
nvkm_runl_rc_cgrp() returns early without scheduling runl->work:
CPU0 (fault handler) CPU1 (runl->work)
gf100_fifo_mmu_fault_recover()
/* fault 1 on chan A */
atomic_set(&engn->rc_reset, 1)
nvkm_runl_rc_cgrp(cgrpA)
cgrpA->rc: NONE -> PENDING
nvkm_runl_rc_runl()
nvkm_runl_rc()
cgrpA->rc: PENDING -> RUNNING
...
atomic_xchg(&engn->rc_reset, 0)
nvkm_engine_reset(engn->engine)
gf100_fifo_mmu_fault_recover()
/* fault 2 on chan A */
atomic_set(&engn->rc_reset, 1)
nvkm_runl_rc_cgrp(cgrpA)
cmpxchg(cgrpA->rc) != NONE
return; <-- engn->rc_reset stays 1
A later recovery on the same runlist (such as a fault on another engine)
will then see engn->rc_reset == 1 and reset engn while an unrelated
channel is running on it.
Conversely, if a second engine in the same channel group faults after
nvkm_runl_rc() has already passed the engine reset loop for the first
fault, setting engn2->rc_reset = 1 followed by nvkm_runl_rc_cgrp()'s early
return will never schedule another recovery pass to consume engn2->rc_reset,
leaving the second engine stalled. And if an unrelated channel group
cgrpB faults on engn while nvkm_runl_rc() is already past the cgrp loop
(for example, waiting for PBDMA idle), the in-progress pass will consume
engn->rc_reset and reset engn before cgrpB's channels have been disabled
and removed from the runlist.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126175531.916097-1-frederic.mahe@cirad.fr?part=1
next prev parent reply other threads:[~2026-11-26 18:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 17:55 [PATCH] drm/nouveau/fifo/gf100-: reset the faulting engine even if it switched channels Frédéric Mahé
2026-11-26 17:55 ` Frédéric Mahé
2026-11-26 18:11 ` sashiko-bot [this message]
2026-11-27 11:29 ` Frédéric Mahé
2026-11-27 11:29 ` Frédéric Mahé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-235999@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=frederic.mahe@cirad.fr \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.