Files
nvdriver/tools/dev_mode.sh
LIghtJUNction 5240a5321e tools: reboot-free dev mode (dev_mode/dev_reload/dev_health) (#86)
* tools: reboot-free dev mode (dev_mode/dev_reload/dev_health) and udev rule

Root-only nvdriver nodes so no desktop process pins nvidia_rs, a reload
script that unbinds GPUs before rmmod, and a pre/post health gate.
Adds the AGENTS.md personal-laptop override that allows no-reboot tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* tools: address review of dev mode scripts

- dev_health: scan threads (ps -L) so a D-state non-leader thread is caught
- dev_reload: keep module parameters as separate quoted words (no glob expansion)
- dev_reload: restart nvidia-persistenced when a holder refuses the teardown
- dev_reload: drop and rebind the /dev/nvidia* aliases around the reload
- dev_reload: enumerate bound PCI devices of every domain

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* dev tools: drop personal override and invalid reload defaults

- AGENTS.md: restore upstream text (the laptop reboot/rmmod override is local, not repo-wide)
- dev_reload.sh: remove rm_api / experimental_r620_ada / dyndbg defaults (not parameters of this module)
- dev_reload.sh: require NV_RS_DEV_RELOAD_BDF, refuse if nvidia_rs is bound to any other device

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-12-01 13:06:36 -05:00

34 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Development mode for nvidia_rs: device nodes root-only, so the module can be reloaded.
#
# sh tools/dev_mode.sh on install the rule; takes effect when the nodes are next created
# sh tools/dev_mode.sh off remove it and give the nodes back to the seat user
# sh tools/dev_mode.sh status
set -eu
cd "$(dirname "$0")/.."
RULE=/etc/udev/rules.d/62-nvdriver-dev.rules
NODES="/sys/class/misc/nvidia-rs-rmapi-ctl /sys/class/misc/nvidia-rs-rmapi-gpu[0-9]* /sys/class/misc/nvidia-rs-uvm"
case "${1:-status}" in
on)
sudo install -m 644 packaging/arch/62-nvdriver-dev.rules "$RULE"
sudo udevadm control --reload
echo "development mode on (nodes become root-only at the next module load or boot)"
;;
off)
sudo rm -f "$RULE"
sudo udevadm control --reload
for n in $NODES; do [ -e "$n" ] && sudo udevadm trigger --action=add "$n"; done
sudo udevadm settle
echo "development mode off"
;;
status)
[ -e "$RULE" ] && echo "development mode: on" || echo "development mode: off"
ls -l /dev/nvidia-rs-rmapi-ctl /dev/nvidia-rs-rmapi-gpu[0-9]* /dev/nvidia-rs-uvm 2>/dev/null || true
;;
*)
echo "usage: $0 on|off|status" >&2
exit 2
;;
esac