diff options
Diffstat (limited to 'tools/guest-diag/pin_gr_stream.py')
| -rw-r--r-- | tools/guest-diag/pin_gr_stream.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/guest-diag/pin_gr_stream.py b/tools/guest-diag/pin_gr_stream.py index c1ef7b2..44f8681 100644 --- a/tools/guest-diag/pin_gr_stream.py +++ b/tools/guest-diag/pin_gr_stream.py @@ -25,12 +25,23 @@ PORT = int(os.environ.get("PINWIN_PORT", "45678")) LO = os.environ.get("PINWIN_LO", "0x200400000") HI = os.environ.get("PINWIN_HI", "0x206000000") PAMAX = os.environ.get("PINWIN_PA_MAX", "0x180000000") +SEMSTREAM = os.environ.get("SEM_STREAM_FILE", "/tmp/opencode/sem_stream.txt") def log(msg): print("[%s] %s" % (time.strftime("%H:%M:%S"), msg), flush=True) +def _mirror(line): + """Append guest control lines (#pid/#sem) to the shared host file so the + single-QMP watcher can consume them without guest-agent round trips.""" + try: + with open(SEMSTREAM, "a") as f: + f.write(line + "\n") + except OSError: + pass + + def vexec(cmd, timeout=40): try: r = subprocess.run([VMEXEC, "exec", "--timeout", str(timeout - 5), cmd], @@ -115,6 +126,10 @@ def main(): m = re.search(r"(\d+)", text) seen = {} log("guest reports cdt pid %s" % (m.group(1) if m else "?")) + _mirror(text) + continue + if text.startswith("#sem"): + _mirror(text) continue m = re.match(r"^(0x[0-9a-f]+),(0x[0-9a-f]+)(?:,(\d+))?$", text) if m: |
