From 9f811bcb791f324622b638dcb17283014dba10fa Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Tue, 29 Sep 2026 13:20:52 -0400 Subject: guest-diag: read trace before clearing (one-shot pushbuffer-create events) --- tools/guest-diag/semfix_watch.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/guest-diag/semfix_watch.py b/tools/guest-diag/semfix_watch.py index c0ce072..c4d45fc 100644 --- a/tools/guest-diag/semfix_watch.py +++ b/tools/guest-diag/semfix_watch.py @@ -88,9 +88,13 @@ def is_gpu(v): def guest_trace(): - """(sem kptrs, pushbuffer kptrs) from the trace ring, then clear it.""" - cmd = ("sudo sh -c 'echo > /sys/kernel/tracing/trace; sleep 2; " - "grep -E \"uvmt|uvpb\" /sys/kernel/tracing/trace | tail -8'") + """(sem kptrs, pushbuffer kptrs) from the trace ring, then clear it. + + Read *before* clearing: uvm_pushbuffer_create fires once per client and + would be wiped by a clear that races it. + """ + cmd = ("sudo sh -c 'grep -E \"uvmt|uvpb\" /sys/kernel/tracing/trace | tail -200; " + "echo > /sys/kernel/tracing/trace'") try: out = subprocess.run([VMEXEC, "exec", cmd], capture_output=True, text=True, timeout=90).stdout -- cgit v1.2.3