diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-29 13:27:22 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-29 13:27:22 -0400 |
| commit | 44a4137cb08939d24536b6db6d06da212cfe4f03 (patch) | |
| tree | c5014f21db5e00480350ea2535403880d5f9e08e | |
| parent | 98031a7a8bc4b33e2ff8a362abcc739bae48779b (diff) | |
| download | open-iov-44a4137cb08939d24536b6db6d06da212cfe4f03.tar.gz open-iov-44a4137cb08939d24536b6db6d06da212cfe4f03.zip | |
guest-diag: identify pushbuffer rm_mem by vmalloc CPU VA (any GPU VA)
| -rw-r--r-- | tools/guest-diag/semfix_watch.py | 17 |
1 files changed, 11 insertions, 6 deletions
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) |
