Files
nvdriver/tools/decode_original_pt_bounded.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

23 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""Bound PT decode output/errors; preserve raw data and declare incomplete decode."""
from pathlib import Path
import argparse,json,subprocess,signal,time,os,re,collections
p=argparse.ArgumentParser();p.add_argument('--input',required=True);p.add_argument('--kallsyms',required=True);p.add_argument('--output',type=Path,required=True);p.add_argument('--time');p.add_argument('--max-lines',type=int,default=20000);p.add_argument('--max-errors',type=int,default=100);p.add_argument('--all-symbols',action='store_true');p.add_argument('--itrace',choices=['ce','be'],default='ce');a=p.parse_args();a.output.parent.mkdir(parents=True,exist_ok=True)
symbols=['_nv000790rm','_nv030241rm','_nv033663rm','_nv033665rm','_nv016741rm','_nv016753rm','_nv028470rm','_nv043236rm','_nv043182rm','_nv027605rm','_nv029864rm','_nv033231rm','_nv033300rm','_nv055403rm','_nv028309rm','_nv028308rm','_nv043609rm']
command=['perf','script','-i',a.input,'--itrace='+a.itrace,'--ns','-F','comm,pid,tid,time,ip,sym,symoff,addr,dso,flags','--kallsyms',a.kallsyms]
if not a.all_symbols:command+=['-S',','.join(symbols)]
if a.time:command+=['--time',a.time]
lines=0;errors=0;error_codes=collections.Counter();stop=None;start=time.monotonic();errpath=a.output.with_suffix('.stderr');reportpath=a.output.with_suffix('.json')
with a.output.open('w')as f,errpath.open('w')as err:
child=subprocess.Popen(command,stdout=subprocess.PIPE,stderr=err,text=True,start_new_session=True)
for line in child.stdout:
f.write(line);lines+=1
if 'instruction trace error'in line:
errors+=1;match=re.search(r'code (\d+):',line);error_codes[match.group(1)if match else'unknown']+=1
if errors>=a.max_errors or lines>=a.max_lines:
stop='error_limit'if errors>=a.max_errors else'line_limit';child.send_signal(signal.SIGINT);break
child.stdout.close()
try:status=child.wait(timeout=10)
except subprocess.TimeoutExpired:child.kill();status=child.wait();stop=stop or'decoder_shutdown_timeout'
report={'command':command,'exit_code':status,'stop':stop,'output_lines':lines,'trace_errors':errors,'error_codes':dict(error_codes),'instruction_mismatch_errors':error_codes.get('6',0),'elapsed_seconds':time.monotonic()-start,'scope':'Bounded decoder observation only. A size-limited source capture, interrupted/error decode or limited requested time cannot establish absent events.'};reportpath.write_text(json.dumps(report,indent=2)+'\n');print(json.dumps(report))