diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-28 07:34:34 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-28 07:34:34 -0400 |
| commit | 2133dd1fd82b4fd37df45e134b9a073f081d49d1 (patch) | |
| tree | 2e8f1e779833a27f9e0325ec037a06a244a54637 /tools/guest-diag/sempages.py | |
| parent | 4b214ba45276a8d60161d74ffcb303a28d5f4dab (diff) | |
| download | open-iov-2133dd1fd82b4fd37df45e134b9a073f081d49d1.tar.gz open-iov-2133dd1fd82b4fd37df45e134b9a073f081d49d1.zip | |
sema-svc: apply releases promptly and decode compute-push releases
The content sweep now:
- decodes a release whose method stream continues with any INC_METHOD,
not only the CE LAUNCH_DMA group, so the releases at the head of a
compute/GR channel's first push are applied too;
- remembers releases whose target VA had no translation (deferred list)
and retries them every service pass, so a VA->PA injection lands them
immediately instead of after the next full sweep;
- re-arms the fast sliced sweep for a few seconds after an injection;
- treats a channel whose USERD/ring cannot be resolved as stalled, so the
sweep keeps looking for the releases its unreadable pushes carry.
tools: add per-cdt client-pin helper (sem pages + /dev/nvidia0 windows),
sem-page scanner and memprobe fixes (short-read guard, --brief).
Live-verified: injecting a client sem page applied 12 deferred releases
within a second; the service kept applying (89 -> 202) while cdt ran.
Diffstat (limited to 'tools/guest-diag/sempages.py')
| -rwxr-xr-x | tools/guest-diag/sempages.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/guest-diag/sempages.py b/tools/guest-diag/sempages.py new file mode 100755 index 0000000..ad4dae6 --- /dev/null +++ b/tools/guest-diag/sempages.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +# Print the distinct pages of the semaphore VAs a process references +# (reuses memprobe.py's scanner; run in the guest as root). The VA window is +# derived from the process's /dev/nvidia* mappings unless lo/hi are given. +# usage: sudo python3 sempages.py <pid> [lo] [hi] +import os +import sys + +sys.path.insert(0, '/tmp') +import memprobe as m + +pid = int(sys.argv[1]) +if len(sys.argv) > 3: + lo = int(sys.argv[2], 16) + hi = int(sys.argv[3], 16) +else: + lo = 1 << 64 + hi = 0 + with open('/proc/%d/maps' % pid) as f: + for line in f: + parts = line.split() + if len(parts) < 6 or not parts[5].startswith('/dev/nvidia'): + continue + a, b = parts[0].split('-') + lo = min(lo, int(a, 16)) + hi = max(hi, int(b, 16)) + if hi == 0: + print('no /dev/nvidia mappings') + raise SystemExit(1) + +fd = os.open('/proc/%d/mem' % pid, os.O_RDONLY) +sems = m.sem_objs(pid, fd, lo, hi) +os.close(fd) +pages = sorted({va & ~0xfff for va in sems}) +print('sem VAs: %d pages: %d (window 0x%x..0x%x)' % (len(sems), len(pages), lo, hi)) +for pg in pages: + print('0x%x' % pg) |
