diff options
Diffstat (limited to 'tools/guest-diag/wall2/pdbtick.py')
| -rw-r--r-- | tools/guest-diag/wall2/pdbtick.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/tools/guest-diag/wall2/pdbtick.py b/tools/guest-diag/wall2/pdbtick.py index 35b9ab8..d65b79d 100644 --- a/tools/guest-diag/wall2/pdbtick.py +++ b/tools/guest-diag/wall2/pdbtick.py @@ -41,15 +41,29 @@ def main(): t = threading.Thread(target=worker, args=(a, b)); t.start(); ts.append(t) for t in ts: t.join() if not res: - print("RING NOT FOUND"); return 1 - # prefer the most recently written: check which page's entries beyond the - # first three match this run's full 16-entry sequence; else take the last + print("RING NOT FOUND") + return None hits = [gpa_of(x) for x in res] - print("ring candidates:", [hex(h) for h in hits]) + print("ring candidates:", [hex(h) for h in hits], flush=True) for gpa in hits: cmd = "echo 0x%x,0x%x > %s" % (RING_VA, gpa, PARAM) r = subprocess.run(["sudo", "sh", "-c", cmd], capture_output=True) - print("sema_pdb_discover 0x%x,0x%x rc=%d" % (RING_VA, gpa, r.returncode)) - return 0 + print("sema_pdb_discover 0x%x,0x%x rc=%d" % (RING_VA, gpa, r.returncode), flush=True) + return hits -sys.exit(main()) + +def loop(): + import time as _t + dur = float(sys.argv[1]) if len(sys.argv) > 1 else 120 + end = _t.time() + dur + fired = set() + while _t.time() < end: + hits = main() + if hits: + new = [h for h in hits if h not in fired] + if new: + fired.update(new) + _t.sleep(1.0) + print("# pdbtick end", flush=True) + +loop() |
