Files
nvdriver/tools/check_original_live_timer_init.py
nvidia-driver-rs 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

102 lines
6.0 KiB
Python

#!/usr/bin/env python3
"""Validate the finite closed-driver timeout/Timer StateLoad capture.
Function entries establish attempted calls and argument values, not returns.
This checker makes no replacement-driver or other-hardware parity claim.
"""
import argparse
from collections import Counter
import hashlib
import json
from pathlib import Path
import re
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("report_directory", type=Path)
args = parser.parse_args()
root = args.report_directory
before = json.loads((root / "before.json").read_text())
after = json.loads((root / "after.json").read_text())
raw = json.loads((root / "rea-capture.json").read_text())
evidence = raw.get("structuredContent")
if evidence is None:
evidence = json.loads(next(c["text"] for c in raw["content"] if c["type"] == "text"))
capture = evidence["normalized_result"]
pattern = re.compile(
r"^\s*(\S+)\s+(\d+)/(\d+)\s+(\d+)\.(\d{9}):\s+"
r"mem:(0x[0-9a-f]+):x:\s+([0-9a-f]+)\s+(_nv\d+rm)\s+ABI:2(.*)$"
)
events, rejected = [], []
for line in (root / "perf-script.txt").read_text().splitlines():
if not line.strip():
continue
match = pattern.fullmatch(line)
if match is None:
rejected.append(line)
continue
comm, pid, tid, sec, ns, address, ip, name, registers = match.groups()
events.append({
"comm": comm, "pid": int(pid), "tid": int(tid),
"perf_time_ns": int(sec) * 1_000_000_000 + int(ns),
"address": address, "ip": "0x" + ip, "symbol": name,
"registers": dict(re.findall(r"\b(AX|CX|DX|SI|DI):(0x[0-9a-f]+)", registers)),
})
defaults = [e for e in events if e["symbol"] == "_nv059507rm"]
configs = [e for e in events if e["symbol"] == "_nv059487rm"]
loads = [e for e in events if e["symbol"] == "_nv059665rm"]
groups = []
for load in loads:
gpu = load["registers"]["DI"]
ds = [e for e in defaults if e["registers"]["SI"] == gpu]
cs = [e for e in configs if e["registers"]["DI"] == gpu]
groups.append({
"gpu_owner": gpu, "timer_owner": load["registers"]["SI"],
"load_flags": int(load["registers"]["DX"], 16),
"default_data_offsets": [int(e["registers"]["DI"], 16) - int(gpu, 16) for e in ds],
"timeout_us": [int(e["registers"]["SI"], 16) for e in cs],
"timeout_flags": [int(e["registers"]["DX"], 16) for e in cs],
"initial_order": bool(ds and cs and ds[0]["perf_time_ns"] < cs[0]["perf_time_ns"] < load["perf_time_ns"]),
})
dump = (root / "perf-dump.txt").read_text()
losses = {name: dump.count(name) for name in (
"PERF_RECORD_LOST", "PERF_RECORD_THROTTLE", "PERF_RECORD_UNTHROTTLE")}
output = "".join(frame["data"] for frame in capture["frames"])
checks = {
"original_cuda_passed_64_words_and_destroyed_context": capture["exit"]["code"] == 0
and all(s in output for s in ('"passed":true', '"verified_words":64', '"context_destroyed":true')),
"all_28_samples_parsed": len(events) == 28 and not rejected,
"function_addresses_match_snapshot": all(e["address"] == e["ip"] == before["symbols"][e["symbol"]] for e in events),
"ordered_perf_timestamps": all(a["perf_time_ns"] <= b["perf_time_ns"] for a, b in zip(events, events[1:])),
"no_reported_loss_or_throttle": not any(losses.values()),
"eight_distinct_gpu_and_timer_owners": len(groups) == len({g["gpu_owner"] for g in groups}) == len({g["timer_owner"] for g in groups}) == 8,
"per_owner_default_then_thread_config_then_timer_load": bool(groups) and all(g["initial_order"] for g in groups),
"all_observed_data_to_gpu_argument_offsets_match_1e08": bool(groups) and all(g["default_data_offsets"] and all(v == 0x1e08 for v in g["default_data_offsets"]) for g in groups),
"all_initial_configs_4s_os_timer_and_load_flags_zero": bool(groups) and all(g["timeout_us"][0] == 4_000_000 and all(f == 8 for f in g["timeout_flags"]) and g["load_flags"] == 0 for g in groups),
"one_owner_4s_30s_4s_seven_owners_4s": Counter(tuple(g["timeout_us"]) for g in groups) == Counter({(4_000_000,): 7, (4_000_000, 30_000_000, 4_000_000): 1}),
"retained_input_hashes_match": before["sha256"] == after["sha256"],
"eight_original_gpu_bindings_unchanged": len(before["bindings"]) == 8 and before["bindings"] == after["bindings"] and set(after["bindings"].values()) == {"nvidia"},
"runtime_addresses_unchanged": before["symbols"] == after["symbols"],
"recorded_perf_file_matches": after["perf_sha256"] == hashlib.sha256((root / "perf.data").read_bytes()).hexdigest(),
}
report = {
"passed": all(checks.values()), "checks": checks,
"rea_capture_evidence": evidence["evidence_id"],
"counts": dict(Counter(e["symbol"] for e in events)),
"record_loss_diagnostics": losses, "gpu_groups": groups,
"events": events, "rejected": rejected,
"scope": "One finite original580 V100 per-open/context lifecycle; entry attempts only. No mapping of object pointers to BDFs, function return proof, boot/probe capture, deferred-worker coverage, other-hardware support, performance baseline or Rust readiness.",
"unobserved_path": "No059564 OS-relative entry was sampled on these workload threads. This does not establish path absence or an empty OS-event list.",
"interpretation": "The 4s/30s/4s transition agrees with separately instruction-proven compute-reference policy; computeRefCount itself was not sampled.",
"related_static_proof": "reports/timer-timeout-provenance.json",
"rea_process_sampling_limits": evidence["limitations"],
}
(root / "validation.json").write_text(json.dumps(report, indent=2) + "\n")
print(json.dumps({"passed": report["passed"], "checks": checks, "counts": report["counts"]}, indent=2))
return 0 if report["passed"] else 1
if __name__ == "__main__":
raise SystemExit(main())