summaryrefslogtreecommitdiffstats
path: root/tools
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
commit5b80f3d5e1b9a597a7e7e0d761a5fa8b5804dbc1 (patch)
treed9dde0e9f59099edda901b4117b8e076eddc1260 /tools
parent09a729ac2a8c6f1865d5ef3bfd2b4df55d43764a (diff)
downloadopen-iov-5b80f3d5e1b9a597a7e7e0d761a5fa8b5804dbc1.tar.gz
open-iov-5b80f3d5e1b9a597a7e7e0d761a5fa8b5804dbc1.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')
-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: