summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
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: