summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/guest-diag/semfix_watch.py17
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)