summaryrefslogtreecommitdiffstats
path: root/tools/guest-diag
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-29 16:32:03 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-29 16:32:03 -0400
commit26e6bc390cc9f466448a7470420d9de750e7611e (patch)
treefba1cfb5268eed295f08459214794bd51e7aa068 /tools/guest-diag
parenta6cee384160b3210911838f79a8082d541da00f5 (diff)
downloadopen-iov-26e6bc390cc9f466448a7470420d9de750e7611e.tar.gz
open-iov-26e6bc390cc9f466448a7470420d9de750e7611e.zip
sema-svc: bounded diagnostics for GR counter writes; scanner guarantees counter-page delta
- rel-apply/publish now log the first 32/48 outcomes (written, skipped with current value, no slot, read failure) so the live counter page can be matched against host writes. - guest pin scanner logs the counter page's pagemap state each loop and adds it to the delta set explicitly, so the page is pinned the moment it is mapped even if the window scan misses it.
Diffstat (limited to 'tools/guest-diag')
-rw-r--r--tools/guest-diag/guest_pin_stream.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/guest-diag/guest_pin_stream.py b/tools/guest-diag/guest_pin_stream.py
index 8d0b34d..717a05d 100644
--- a/tools/guest-diag/guest_pin_stream.py
+++ b/tools/guest-diag/guest_pin_stream.py
@@ -141,6 +141,26 @@ def main():
time.sleep(INTERVAL)
continue
dt = time.time() - t0
+ # Diagnostic: the GR completion-counter page is the one page the
+ # client's context-init wait polls; log its pagemap entry every loop
+ # so a scan blind spot is visible in the guest log.
+ cpm = None
+ try:
+ fdp = os.open('/proc/%d/pagemap' % pid, os.O_RDONLY)
+ os.lseek(fdp, (0x20400fec0 // 4096) * 8, 0)
+ cpm = int.from_bytes(os.read(fdp, 8), 'little')
+ os.close(fdp)
+ except OSError:
+ cpm = None
+ diag = ('cpm=%s' % ('present' if (cpm or 0) >> 63 & 1 else 'absent')
+ if cpm is not None else 'cpm=ERR')
+ # Guaranteed fast path for the GR completion-counter page: if the
+ # window scan misses it (observed once), add it explicitly so the host
+ # can register the slots before the client's first wait.
+ if cpm is not None and (cpm >> 63) & 1:
+ cpa = (cpm & ((1 << 55) - 1)) << 12
+ if cpa and (not PAMAX or cpa < PAMAX):
+ cur[0x20400f000] = cpa
new = [(va, pa) for va, pa in cur.items() if seen.get(va) != pa]
seen = cur
lines = []
@@ -152,9 +172,9 @@ def main():
last_log = now
try:
with open('/tmp/guest_pin_stream.log', 'a') as f:
- f.write('%s pid=%s present=%d new=%d sem=%d scan=%.3fs\n'
+ f.write('%s pid=%s present=%d new=%d sem=%d scan=%.3fs %s\n'
% (time.strftime('%T'), pid, len(cur), len(new),
- len(seen_sems), dt))
+ len(seen_sems), dt, diag))
except OSError:
pass
if not new and not lines: