mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 06:28:39 +00:00
- tools/decode_original_pt_bounded.py: validate --max-lines/--max-errors >= 1, guard perf child teardown in try/finally, report missing perf cleanly, propagate non-zero perf exit codes when not stopped by a limit, and wrap in main(). - tools/check_uvm_620_exports.py: fail cleanly on missing module files or empty undefined nvUvmInterface* symbol set (preventing false green on stripped/wrong binaries), parse CLI via argparse, and wrap in main(). - tools/check_mmu_oracle.py and tools/timer-alarm-vectors.py: replace -O-elidable assert checks with explicit SystemExit errors and wrap in main(). - tools/check_compat_layout.py: resolve NVIDIA 580.178.04 include dirs via NV_RS_ANALYSIS_ROOT / NV_RS_KERNEL_SRC / OPEN_GPU_ROOT / /usr/src/nvidia-580.178.04 instead of hardcoding /home/geodd, replace -O-elidable asserts, and wrap in main(). - tools/check_original_live_init.py: close timestamped-record-dump.txt with a context manager and wrap in main(). - tests/offline/test_oracle_check_and_pt_decoder_tools.py: offline unit tests verified under python3 -O.
54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Offline check: every nvUvmInterface* symbol stock 620.73.04 nvidia-uvm.ko needs
|
|
is exported by our nvidia_rs_uvm_bridge.ko. Needs no GPU and no module loading.
|
|
|
|
usage: check_uvm_620_exports.py [stock-nvidia-uvm.ko] [bridge.ko]
|
|
"""
|
|
import argparse
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
DEFAULT_STOCK = ROOT / "../nvidia-open-620.73.04/kernel-open/nvidia-uvm.ko"
|
|
DEFAULT_BRIDGE = ROOT / "kernel-open/uvm_bridge/nvidia_rs_uvm_bridge.ko"
|
|
|
|
|
|
def syms(path, kind):
|
|
if not path.is_file():
|
|
raise SystemExit(f"module not found: {path}")
|
|
out = set()
|
|
for line in subprocess.check_output(["nm", str(path)], text=True).splitlines():
|
|
p = line.split()
|
|
if not p:
|
|
continue
|
|
name = p[-1]
|
|
if kind == "T":
|
|
# an export is a __ksymtab_ entry, not just a defined function
|
|
if name.startswith("__ksymtab_nvUvmInterface"):
|
|
out.add(name[len("__ksymtab_"):])
|
|
elif len(p) >= 2 and name.startswith("nvUvmInterface") and p[-2] == "U":
|
|
out.add(name)
|
|
return out
|
|
|
|
|
|
def main(argv=None):
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("stock", nargs="?", type=Path, default=DEFAULT_STOCK)
|
|
parser.add_argument("bridge", nargs="?", type=Path, default=DEFAULT_BRIDGE)
|
|
args = parser.parse_args(argv)
|
|
|
|
need = syms(args.stock, "U")
|
|
have = syms(args.bridge, "T")
|
|
if not need:
|
|
raise SystemExit(f"no undefined nvUvmInterface* symbols found in {args.stock}")
|
|
missing = sorted(need - have)
|
|
print(f"stock needs {len(need)} nvUvmInterface* symbols; bridge exports {len(have)}; missing {len(missing)}")
|
|
for m in missing:
|
|
print(" MISSING", m)
|
|
return 1 if missing else 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|