mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 14:38:47 +00:00
- Updated tools/post_reboot.sh to check kernel oops taint bit and stuck driver tasks instead of <86400s uptime - Level 7 hardware regression passed on 0000:b3:00.0 (module 37e6fa430835eee2b426019db3ad70eeb7a9e9070c09c84bd9b973cf56cbe529, 107 inventory words, 0 static mismatches, CUDA baseline verified before and after) - Updated .gitignore to exclude build archives (*.a, *.rlib), __pycache__, and raw trace dumps
81 lines
4.1 KiB
Bash
81 lines
4.1 KiB
Bash
#!/bin/sh
|
|
# Run once after the reboot that clears the mmiotrace oops of 2026-11-18.
|
|
#
|
|
# sh tools/post_reboot.sh health check + original-driver CUDA baseline
|
|
# sh tools/post_reboot.sh --first-open the same, then the first hardware open of
|
|
# nvidia_rs on 0000:b3:00.0 (bring-up level 2)
|
|
#
|
|
# Every step must pass before the next one runs. The output is also written to
|
|
# reports/post-reboot-<UTC time>.log so the next session can read it.
|
|
set -u
|
|
ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
|
PCI=0000:b3:00.0
|
|
STAMP=$(date -u +%Y%m%dT%H%M%SZ)
|
|
LOG="$ROOT/reports/post-reboot-$STAMP.log"
|
|
FIRST_OPEN=0
|
|
[ "${1:-}" = "--first-open" ] && FIRST_OPEN=1
|
|
|
|
say() { printf '%s\n' "$*" | tee -a "$LOG"; }
|
|
fail() { say "FAIL: $*"; say "Stopped. Log: $LOG"; exit 1; }
|
|
|
|
say "post-reboot check $STAMP kernel $(uname -r)"
|
|
|
|
# 1. The machine is clean (no kernel oops taint bit, no stuck driver tasks).
|
|
UP=$(cut -d. -f1 /proc/uptime)
|
|
TAINT=$(cat /proc/sys/kernel/tainted)
|
|
say "uptime ${UP}s, taint $TAINT"
|
|
[ $((TAINT & 128)) -eq 0 ] || fail "kernel taint $TAINT has oops bit (128) set"
|
|
STUCK=$(ps -eo stat,comm | grep -E '^D.*(nv_open_q|nvidia)' || true)
|
|
[ -z "$STUCK" ] || fail "stuck driver tasks in D state: $STUCK"
|
|
pgrep -x native-hello >/dev/null && fail "a native-hello process exists"
|
|
[ -e /sys/module/nvidia_rs ] && fail "nvidia_rs is loaded"
|
|
[ "$(cat /sys/devices/system/cpu/online)" = "0-63" ] || fail "not all CPUs are online"
|
|
TRACER=$(sudo -n cat /sys/kernel/tracing/current_tracer 2>/dev/null || echo unreadable)
|
|
say "tracer $TRACER"
|
|
[ "$TRACER" = "nop" ] || fail "tracer is '$TRACER', expected nop (is sudo available without a password?)"
|
|
|
|
# 2. All eight V100s are on the original driver.
|
|
for d in 1a 1b 3d 3e 88 89 b2 b3; do
|
|
link=/sys/bus/pci/devices/0000:$d:00.0/driver
|
|
name=$([ -e "$link" ] && basename "$(readlink "$link")" || echo none)
|
|
say "0000:$d:00.0 driver=$name"
|
|
[ "$name" = "nvidia" ] || fail "0000:$d:00.0 is not bound to the original driver"
|
|
done
|
|
grep -q "580.178.04" /proc/driver/nvidia/version || fail "original driver is not 580.178.04"
|
|
|
|
# 3. nvidia-smi answers (it hung before the reboot) and nothing is using a GPU.
|
|
SMI=$(timeout 120 nvidia-smi --query-gpu=pci.bus_id,memory.used --format=csv,noheader,nounits 2>&1) \
|
|
|| fail "nvidia-smi failed or timed out: $SMI"
|
|
say "$SMI"
|
|
[ "$(printf '%s\n' "$SMI" | wc -l)" -eq 8 ] || fail "nvidia-smi does not list eight GPUs"
|
|
APPS=$(timeout 120 nvidia-smi --query-compute-apps=pid --format=csv,noheader 2>&1)
|
|
[ -z "$APPS" ] || fail "GPU compute processes are running: $APPS"
|
|
|
|
# 4. Original-driver baseline: the native CUDA kernel on the test GPU.
|
|
HELLO="$ROOT/target/hardware-hello"
|
|
[ -x "$HELLO/native-hello" ] || fail "$HELLO/native-hello is missing (rebuild it first)"
|
|
OUT=$(timeout 600 "$HELLO/native-hello" "$HELLO/native_hello.sm70.cubin" "$PCI" 317866785 2>&1) \
|
|
|| fail "native-hello failed on the original driver: $OUT"
|
|
say "baseline: $OUT"
|
|
printf '%s' "$OUT" | grep -q '"verified_words": *64' || fail "baseline did not verify 64 words"
|
|
say "PASS: machine is healthy and the original driver runs CUDA on $PCI"
|
|
|
|
if [ "$FIRST_OPEN" -eq 0 ]; then
|
|
say "First hardware open not requested. To run it: sh tools/post_reboot.sh --first-open"
|
|
say "Log: $LOG"
|
|
exit 0
|
|
fi
|
|
|
|
# 5. Replacement hardware execution: first open of nvidia_rs, then restore.
|
|
say "module $(sha256sum "$ROOT/kernel-open/nvidia_rs.ko")"
|
|
sudo python3 "$ROOT/tools/run_hardware_first_open.py" --pci "$PCI" --confirm "$PCI" \
|
|
--label "b3-$STAMP" --bringup "${BRINGUP:-2}" ${BRINGUP_BAR1:+--bringup-bar1} 2>&1 | tee -a "$LOG"
|
|
say "driver after: $(basename "$(readlink /sys/bus/pci/devices/$PCI/driver 2>/dev/null)")"
|
|
|
|
# 6. The original driver must still work on the GPU afterwards.
|
|
OUT=$(timeout 600 "$HELLO/native-hello" "$HELLO/native_hello.sm70.cubin" "$PCI" 317866785 2>&1) \
|
|
|| fail "native-hello failed after restoring the GPU: $OUT"
|
|
say "after restore: $OUT"
|
|
printf '%s' "$OUT" | grep -q '"verified_words": *64' || fail "post-restore run did not verify 64 words"
|
|
say "PASS: first open ran and the GPU is back on the original driver. Log: $LOG"
|