diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-24 01:58:15 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-24 01:58:15 -0400 |
| commit | 3b9432714a0515b89309ff2e6c1983690fb67761 (patch) | |
| tree | 6ee1d2c33c6f0868e1f5316c2f2c9d6347a01f7f /tools/guest-diag/guest_pmap.py | |
| parent | db34d52120055c927aad160b2c73c390485333ea (diff) | |
| download | open-iov-3b9432714a0515b89309ff2e6c1983690fb67761.tar.gz open-iov-3b9432714a0515b89309ff2e6c1983690fb67761.zip | |
kernel: validate learned semaphore maps and post guest GPU events
- admit {GPU VA -> PA} pairs only when the preceding bytes form a valid
client memory descriptor header (type 0/1, CPU+GPU mapped bits), prefer
validated pairs over headerless candidates under first-wins dedup, and
invalidate the translation cache on every rebuild; fixes stale identity
entries shadowing live pool pages and lets the guest UVM channel
bring-up complete on its own
- capture OS event allocations (class 0x79) and post event records
(function 0x1003) into the guest status queue when a channel's busy
notification is consumed, with a broadcast fallback, serialized with
replies via a queue lock
- add BAR0 shadow introspection (dump_bar0/scan_bar0) and guest-side
diagnostic scripts for the VM cycle
Diffstat (limited to 'tools/guest-diag/guest_pmap.py')
| -rw-r--r-- | tools/guest-diag/guest_pmap.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/guest-diag/guest_pmap.py b/tools/guest-diag/guest_pmap.py new file mode 100644 index 0000000..96b7ddc --- /dev/null +++ b/tools/guest-diag/guest_pmap.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +# guest-side helper: translate GPU/user VAs of a process through its pagemap. +# Usage: sudo python3 guest_pmap.py <pid> <hex-va> [hex-va ...] +import os +import sys + +pid = int(sys.argv[1]) +vas = [int(x, 16) for x in sys.argv[2:]] + +maps = [] +try: + with open('/proc/%d/maps' % pid) as f: + for line in f: + parts = line.split() + a, b = parts[0].split('-') + maps.append((int(a, 16), int(b, 16), line.strip())) +except OSError as e: + print('MAPS_ERROR: %s' % e) + +def in_maps(va): + for a, b, line in maps: + if a <= va < b: + return line + return None + +fd = os.open('/proc/%d/pagemap' % pid, os.O_RDONLY) +try: + for va in vas: + os.lseek(fd, (va // 4096) * 8, 0) + e = int.from_bytes(os.read(fd, 8), 'little') + present = (e >> 63) & 1 + pfn = e & ((1 << 55) - 1) + pa = (pfn << 12) | (va & 0xfff) + line = in_maps(va) + print('VA=0x%x present=%d PA=0x%x map=%s' % (va, present, pa, line if line else '-')) +finally: + os.close(fd) |
