diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/guest-diag/pin_gr_stream.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/tools/guest-diag/pin_gr_stream.py b/tools/guest-diag/pin_gr_stream.py index 1acef4b..7a9bb66 100644 --- a/tools/guest-diag/pin_gr_stream.py +++ b/tools/guest-diag/pin_gr_stream.py @@ -230,13 +230,24 @@ def _demand_loop(): expiry) as the stalled-VA class. """ track = {} # va -> [first_seen, last_sent] + it = 0 while True: - time.sleep(3) - try: - r = subprocess.run(["sudo", "-n", "dmesg"], - capture_output=True, text=True, timeout=20) - except Exception: - continue + # SESSION 153-CONTINUED-57: the 3 s pass was the losing half of the + # r1096 race - the beef setup-hold's demanded pages resolved in the + # guest ~2-4 s after the arm, while the pump re-read the entry + # every ~110 ms and moved on. Poll fast (0.75 s) so a newly armed + # demand goes to the guest within a second; the expensive dmesg + # harvest stays on a slower cadence (every 4th pass) because the + # debugfs setup-demand set is the time-critical source. + time.sleep(0.75) + it += 1 + r = None + if it % 4 == 1: + try: + r = subprocess.run(["sudo", "-n", "dmesg"], + capture_output=True, text=True, timeout=20) + except Exception: + continue now = time.time() for m in re.finditer( r"(?:stalled VA #\d+[:=]\s*" @@ -258,7 +269,7 @@ def _demand_loop(): # cannot, the guest content resolver is the last source - # harvest the VA so it resolves and injects the real page. r"|sema-pushzero: h=0x[0-9a-f]+ va=(0x[0-9a-f]+)", - (r.stdout or "")[-2000000:]): + (r.stdout or "")[-2000000:] if r else ""): va = int(m.group(1) or m.group(2) or m.group(3), 16) track.setdefault(va, [now, 0.0]) # SESSION 153-CONTINUED-51: the pushzero line now carries the @@ -268,7 +279,7 @@ def _demand_loop(): # whole push at once (bulk demand instead of one page per cycle). for m in re.finditer( r"sema-pushzero: h=0x[0-9a-f]+ va=(0x[0-9a-f]+) len=(\d+)", - (r.stdout or "")[-2000000:]): + (r.stdout or "")[-2000000:] if r else ""): zva = int(m.group(1), 16) zlen = int(m.group(2)) for zoff in range(0, min(zlen, 0x8000), 0x1000): |
