Files
nvdriver/tests/thread-state
morebrackets 6435d65112 fix(rmapi/modeset): rmmod refcnt leak (#491), modeset RM ops (#466), runtime logs/fw warning (#501) (#513)
* fix(ga10x/rmapi/modeset): R620 control translation, rmmod refcnt, modeset RM ops (#504, #491, #466, #501)

* chore(pr513): drop gsp_route R620 hunk in favor of live-verified #514

* fix(gpu_owner): balance get_task_struct with put_task_struct after kthread_stop

* fix(gpu_owner/irq): wait for runtime worker join & pin/teardown failed runtime IRQ close

Addresses CodeRabbit review findings on PR #513 (and #491/#528):
- gpu_owner.c: Wait for runtime_stopped in a 10s warning loop and always join
  via kthread_stop() + put_task_struct() so an unpinned runtime worker can
  never outlive module text during PCI removal / rmmod.
- irq_adapter.c: When nv_rs_irq_close() fails to quiesce an unpinned
  runtime-kthread IRQ owner, acquire THIS_MODULE before returning the error
  (or force-disable/synchronize/free handlers if the module is already
  unloading so no callback can outlive module text).
- ga10x_events.rs: Check nv_rs_irq_close() status in stop() and restore e.irq
  on failure instead of discarding the handle.
- tests/irq-mock: Cover both live-pin and unloading-force-teardown paths.

* fix(pci,irq): disable PCI INTx on forced IRQ close and bound AER/shutdown runtime stop

Address follow-up review findings on #513:
- In nv_rs_irq_close() forced teardown (unpinned runtime worker after mask
  failure), call pci_intx(owner->pdev, 0) for legacy INTx mode so the
  device stops asserting its level-triggered line without disabling a
  shared IRQ line for other devices, and add an irq-mock regression test.
- Add nv_rs_gpu_owner_runtime_stop_bounded(owner, timeout_ms) preserving
  runtime_task and runtime_stopping on timeout (preventing restart races
  and allowing a later nv_rs_remove() stop to complete the join).
- In nv_rs_shutdown() and nv_rs_aer_error_detected(), call pci_clear_master()
  first for immediate DMA containment, then use a bounded runtime stop so
  shutdown and PCIe AER callbacks never wedge indefinitely.

* fix(pci,pm): bound runtime_lock wait, reclaim retired worker on start/AER, and reassert BME clear

Address follow-up review findings on #513:
- Include runtime_lock acquisition inside nv_rs_gpu_owner_runtime_stop_bounded()'s
  deadline via bounded mutex_trylock() polling so shutdown/AER cannot hang when
  startup holds runtime_lock waiting for runtime_ready.
- Reclaim a retired worker in nv_rs_gpu_owner_runtime_start() via
  nv_rs_gpu_owner_runtime_reclaim_locked() and in nv_rs_aer_resume() so a
  timed-out bounded stop never strands runtime engines unavailable after recovery.
- Reassert pci_clear_master(pdev) after the serialized stop attempt in
  nv_rs_shutdown() and nv_rs_aer_error_detected() so in-flight GPU bring-up
  cannot leave Bus Master enabled.
- Use nv_rs_gpu_owner_runtime_stop_bounded() in PM suspend/runtime_suspend with
  full state rollback on timeout so suspend cannot wedge indefinitely while
  nv_rs_remove() keeps the unconditional join required before module unload.

* fix(pci): keep Bus Master enabled during bounded GSP unload on shutdown

Address final review comment on #513:
- In nv_rs_shutdown(), invoke nv_rs_gpu_owner_runtime_stop_bounded(owner, 10000)
  before pci_clear_master(pdev) so an active GSP session can complete its
  DMA unload RPC during clean shutdown, then clear Bus Master Enable once
  the stop finishes or hits its bounded deadline.

* fix(pci,pm): return DISCONNECT on AER stop timeout and keep full PM suspend stop

Address review findings on #513:
- In nv_rs_aer_error_detected(), return PCI_ERS_RESULT_DISCONNECT rather than
  PCI_ERS_RESULT_NEED_RESET if nv_rs_gpu_owner_runtime_stop_bounded() times
  out, preventing a PCIe slot reset while a live runtime worker could still
  issue MMIO or re-enable Bus Master.
- In nv_rs_pm_do_suspend() and nv_rs_pmops_runtime_suspend(), wait for worker
  retirement via nv_rs_gpu_owner_runtime_stop() before entering D3hot rather
  than half-aborting after modeset suspend and USERD VMA revocation.

---------

Co-authored-by: morebrackets <19673572+morebrackets@users.noreply.github.com>
2026-12-04 19:48:23 -08:00
..