From 44a4137cb08939d24536b6db6d06da212cfe4f03 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Tue, 29 Sep 2026 13:27:22 -0400 Subject: guest-diag: identify pushbuffer rm_mem by vmalloc CPU VA (any GPU VA) --- tools/guest-diag/semfix_watch.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'tools/guest-diag') diff --git a/tools/guest-diag/semfix_watch.py b/tools/guest-diag/semfix_watch.py index ffadb05..7ae154f 100644 --- a/tools/guest-diag/semfix_watch.py +++ b/tools/guest-diag/semfix_watch.py @@ -87,6 +87,11 @@ def is_gpu(v): return v and GPU_VA_LO <= v < GPU_VA_HI +def is_vmalloc(v): + # pushbuffer rm_mems are vmalloc-mapped (the sem pools are direct-map) + return v and 0xFFFFC90000000000 <= v < 0xFFFFE90000000000 + + def guest_trace(): """(sem kptrs, pushbuffer kptrs) from the trace ring, then clear it. @@ -111,8 +116,8 @@ def resolve_pb_ptr(q, pb): if not mem or not is_kern(mem[0]): return [], None, None vas = q.read64(mem[0] + 0x10, 16) - gpu_vas = [v for v in vas if PUSHBUF_VA_LO <= v < PUSHBUF_VA_HI] - cpu = next((v for v in vas if is_kern(v)), None) + gpu_vas = [v for v in vas if is_gpu(v)] + cpu = next((v for v in vas if is_vmalloc(v)), None) if not gpu_vas or not cpu: return [], None, None gpa = q.gva2gpa(cpu) @@ -175,10 +180,10 @@ def resolve_pushbuffer(q, sem): if not mem or not is_kern(mem[0]): continue vas = q.read64(mem[0] + 0x10, 16) - gpu_vas = [v for v in vas if PUSHBUF_VA_LO <= v < PUSHBUF_VA_HI] + gpu_vas = [v for v in vas if is_gpu(v)] if not gpu_vas: continue - cpu = next((v for v in vas if is_kern(v)), None) + cpu = next((v for v in vas if is_vmalloc(v)), None) if not cpu: continue gpa = q.gva2gpa(cpu) @@ -194,10 +199,10 @@ def resolve_pushbuffer(q, sem): if not mem or not is_kern(mem[0]): continue g5 = q.read64(mem[0] + 0x38) - if not g5 or not (PUSHBUF_VA_LO <= g5[0] < PUSHBUF_VA_HI): + if not g5 or not is_gpu(g5[0]): continue g4 = q.read64(mem[0] + 0x30) - cpu = g4[0] if g4 and is_kern(g4[0]) else None + cpu = g4[0] if g4 and is_vmalloc(g4[0]) else None if not cpu: continue gpa = q.gva2gpa(cpu) -- cgit v1.2.3