summaryrefslogtreecommitdiffstats
path: root/tools/guest-diag/pin_gr_stream.py
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-23 21:32:31 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-23 21:32:31 -0400
commitd4cc5f989943f01875dea86b834d90538a748112 (patch)
treedd45f6cb5a91a747e19a72192e0a43f64001d3f6 /tools/guest-diag/pin_gr_stream.py
parent4f648aba4706af53e746e093ed8137771d947fe1 (diff)
downloadopen-iov-d4cc5f989943f01875dea86b834d90538a748112.tar.gz
open-iov-d4cc5f989943f01875dea86b834d90538a748112.zip
tools: transport-proof demand writes + tolerant demand parsing (the pool-pin latency root cause)
The r581 boot's guest scanner died mid-boot with ValueError in main(): "invalid literal for int() with base 16: '0x20400f000\\n0x121000000\\n0x12000ab4c'". A guest-agent transport-escaped append merged demand VAs onto one line with literal backslash-n, and the old parser crashed on it. The crash stopped ALL new pins; the host only re-asserted known pairs, so the UVM pool VA 0x121000000 never arrived while 185 other injections flowed - the pool-pin latency that blocked every validation boot. * pin_gr_stream._demand_send/_demand_loop now write one "echo <va> >>" per VA (no newlines, no backslashes in the transported command; immune to transport escaping). * guest_pin_stream's demand parser extracts every 0x token with re and skips malformed ones instead of raising out of main().
Diffstat (limited to 'tools/guest-diag/pin_gr_stream.py')
-rw-r--r--tools/guest-diag/pin_gr_stream.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/tools/guest-diag/pin_gr_stream.py b/tools/guest-diag/pin_gr_stream.py
index 6eb5be7..ff7e299 100644
--- a/tools/guest-diag/pin_gr_stream.py
+++ b/tools/guest-diag/pin_gr_stream.py
@@ -100,15 +100,33 @@ def _scanner_alive():
return "ALIVE" in (out or "")
+def _demand_write_cmd(vas):
+ """Build a transport-proof append command for the guest demand file.
+
+ r582: the old `printf '%s' '<lines with real LF>'` form was mangled by
+ the guest-agent transport under load - the newlines arrived as LITERAL
+ backslash-n text and merged VAs onto one line, and the guest scanner's
+ parser then crashed on `int('0x20400f000\\\\n0x121000000...', 16)`
+ (ValueError in main; r581 boot scanner log). The scanner's death stopped
+ ALL new pins while the host only re-asserted known pairs - the observed
+ pool-pin-latency (0x121000000 never arrived while other injections
+ flowed). One `echo <va> >> file` per VA carries no newlines and no
+ backslashes at all, so no transport layer can escape them."""
+ return "; ".join("echo 0x%x >> /tmp/guest_want_vas.txt" % va
+ for va in vas)
+
+
def _demand_send(vas):
"""Append VA hints to the guest scanner's demand file (best-effort).
Same channel pin_gr_stream._demand_loop uses for host-dmesg stalls; the
stall watchdog uses it to ask the scanner to re-resolve the fixed
pre-capture VAs (counter page / UVM pool) by content/pagemap."""
- lines = "".join("0x%x\n" % va for va in vas)
+ cmd = _demand_write_cmd(vas)
+ if not cmd:
+ return
try:
- vexec("printf '%%s' '%s' >> /tmp/guest_want_vas.txt" % lines, 30)
+ vexec(cmd, 30)
except Exception:
pass
@@ -222,9 +240,9 @@ def _demand_loop():
todo = [va for va, (f, l) in track.items() if now - l > 20.0]
if not todo:
continue
- lines = "".join("0x%x\n" % va for va in todo)
+ cmd = _demand_write_cmd(todo)
try:
- vexec("printf '%%s' '%s' >> /tmp/guest_want_vas.txt" % lines, 30)
+ vexec(cmd, 30)
except Exception:
continue
for va in todo: