summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-30 10:06:20 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-30 10:06:20 -0400
commit53698e3b8ecfe7da2f86eb783378bbac006ec19d (patch)
tree671f67a85ed0159c0e9d8381cee628bbbb049adc
parent8479d388b714be710159da62c56398c3548e1563 (diff)
downloadopen-iov-53698e3b8ecfe7da2f86eb783378bbac006ec19d.tar.gz
open-iov-53698e3b8ecfe7da2f86eb783378bbac006ec19d.zip
guest-diag: reset per-client pin state when a new client pid appears
A new CUDA client allocates fresh channel pools at the same GPU VAs; the watcher kept the previous client's sem kptrs and seen-pin marks, so it pinned the previous (freed) pool pages and the new client's release writes went to dead memory. Clear the learned sems/marks on each pid change.
-rwxr-xr-xtools/guest-diag/semfix_uvmt.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/guest-diag/semfix_uvmt.py b/tools/guest-diag/semfix_uvmt.py
index b9f3ac9..636e1f4 100755
--- a/tools/guest-diag/semfix_uvmt.py
+++ b/tools/guest-diag/semfix_uvmt.py
@@ -69,6 +69,16 @@ class Stream:
self.pbs = []
self.new_pbs = []
+ def reset(self):
+ """Forget everything learned about the previous client. A new client
+ allocates its own channel pools; keeping the old sems/seen-pin marks
+ makes the watcher chase stale kernel pointers and pin the previous
+ client's (freed) pool pages - the stale-translation trap."""
+ self.sems = []
+ self.pbs = []
+ self.pids = []
+ self.new_pbs = []
+
def poll(self):
try:
with open(self.path) as f:
@@ -290,6 +300,17 @@ def main():
log("stream: new uvmt sem 0x%x" % s)
for p in new_pids:
log("stream: client pid %d" % p)
+ if last_pid is not None and p != last_pid:
+ stream.reset()
+ known_sems.clear()
+ seen_sem_pin.clear()
+ last_state.clear()
+ last_seen_t.clear()
+ pinned_ranges.clear()
+ seen_ch.clear()
+ seen_pb.clear()
+ counter_pids.clear()
+ log("semfix: new client pid %d - reset per-client pin state" % p)
last_pid = p
for pb in getattr(stream, "new_pbs", []):
log("stream: new pushbuffer 0x%x" % pb)