On Thu, 26 Nov 2026 18:11:26 +0000, [email protected] wrote:
> [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?

Yes. A second fault for a group that is already in recovery sets the
flag, nvkm_runl_rc_cgrp() schedules nothing, and the flag waits for the
next recovery on that runlist, which then resets the engine on behalf of
a group it is not recovering. A duplicate fault entry for one fault is
the likely way to get there (fault buffer on gv100+); on Fermi I only
ever saw one fault per channel kill.

> 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, [...] leaving the second engine stalled.

That case is not recovered without the patch either: the group is
already in recovery, so nothing is scheduled. The patch does not make it
worse, but it does not fix it.

> And if an unrelated channel group cgrpB faults on engn while
> nvkm_runl_rc() is already past the cgrp loop [...] the in-progress pass
> will consume engn->rc_reset and reset engn before cgrpB's channels have
> been disabled and removed from the runlist.

Right, the flag is not tied to the pass that recovers the group.

v2 keeps the faulting engines in the channel group (a mask, rc_engm)
instead of a per-engine flag. The recovery pass collects the mask of
each group it moves from PENDING to RUNNING, after the cmpxchg, and only
resets those engines (plus, as before, engines whose context belongs to
a group in recovery). So:

- a fault for a group already in recovery only adds to that group's
  mask, which no later pass reads, as the group never returns to
  PENDING;
- a pass in progress cannot pick up the mask of a group it did not take
  into recovery; that group's own pass gets it after removing its
  channels.

The mask is written before nvkm_runl_rc_cgrp() (atomic_or, then the
cmpxchg NONE -> PENDING), and read after the PENDING -> RUNNING cmpxchg,
so a pass that takes the group always sees the engines that faulted
before it.

v2 has been through the same tests as v1 on a Quadro 600 (GF108),
with no failure (numbers in its changelog); I am sending it now.

Analysis done with the help of Claude (AI assistant).

Frédéric Mahé

Reply via email to