4 Commits

Author SHA1 Message Date
9b579c4d11 tools: stop dual-GPU parity when the process list is unavailable (#538)
Co-authored-by: shiaho <222622008+shiaho777@users.noreply.github.com>
2026-12-04 16:15:48 -08:00
c9fd6bcaca Address Greptile review findings on #249
- tools/dual_gpu_parity.py (4777559585): extract teardown_nvidia_rs() to
  attempt every cleanup step (unbind, driver_override clear, rmmod) while
  recording failures and verifying /sys/module/nvidia_rs is gone; require
  cleanup_ok in report['passed'] and refuse stock rebind on cleanup failure.
- tools/run_stage8b.sh (4777559594): keep the EXIT trap armed until a single
  teardown_nvidia_rs() helper finishes attempting all cleanup steps and
  returns 0, aborting with exit 2 if any step fails.
- tools/gpu_binding.py (4777559603): check ps exit code in check_no_d_state()
  and fail closed when the process list cannot be read.
- tests/offline/test_parity_and_binding_tools.py: add unit tests for
  teardown_nvidia_rs() failure tracking and check_no_d_state() ps error.
2026-12-02 16:48:31 -08:00
1f510fdb66 fix(tools): fix mawk syntax errors, teardown leaks, and BDF/D-state checks in parity/binding tools
Fixes portability and machine-safety bugs across three hardware runners:

- tools/dual_gpu_parity.py:
  - Replace GNU-awk-only 3-argument match($0, ..., m) calls (syntax error
    under Debian/Ubuntu mawk) with pure-Python dmesg timestamp parsing.
  - Wrap insmod/bind/run/unbind/rmmod in try/finally so errors or timeouts
    never leave nvidia_rs loaded or bound.
  - Gate report["passed"] on no new kernel oops taint bit (TAINT_DIE),
    skip non-JSON braced noise in parse_last_json(), and create the report
    parent directory before writing.
- tools/run_stage8b.sh:
  - Replace GNU-awk-only 3-argument match() calls with POSIX awk
    (verified against mawk), and add an EXIT trap to unbind/rmmod
    nvidia_rs if bind or launch aborts early.
- tools/gpu_binding.py:
  - Normalize PCI BDF strings numerically instead of endswith() matching
    so multi-domain systems cannot false-match.
  - Check for D-state nv_open_q/nvidia tasks before invoking nvidia-smi.
  - Handle non-numeric memory.used values (e.g. [N/A]) fail-closed instead
    of crashing with ValueError, guard missing driver_override, tolerate
    transient nvidia-smi errors during the 30s post-bind retry loop, and
    wrap CLI execution in main().
- tests/offline/test_parity_and_binding_tools.py:
  - Add 6 offline unit tests covering dmesg parsing, taint/JSON checks,
    BDF normalization, [N/A] handling, and POSIX awk under system awk.
2026-12-02 01:57:46 -08:00
4526e6a816 Baseline: validated 30/30 tree with passing Level 7 hardware regression
- 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
2026-11-23 23:48:38 +00:00