summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-28 15:32:28 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-28 15:32:28 -0400
commitd6581109e3ef2d7848b9efd5ae42b7c9facefee8 (patch)
tree8aeaf821ebbae25fe96ad5d87d572f932139c246 /tools
parent612bcec57229d1e74b04cac36d0f4b62a9bf9ebd (diff)
downloadopen-iov-d6581109e3ef2d7848b9efd5ae42b7c9facefee8.tar.gz
open-iov-d6581109e3ef2d7848b9efd5ae42b7c9facefee8.zip
guest-diag: pin_sem_fast.sh - 2 s tracker-sem pinner with a per-pid guard
The 15 s pinner loses the race against the client's internal deadline in most boots: in the one boot where UVM's page-table write pushes were submitted the pin had landed early, and later pins (60 s+) left the client dead before submitting anything. Poll the guest pagemap every 2 s and pin 0x20400f000 once per cdt pid (re-pinning the same pid also stirred the pump's rewind repeatedly, which is why the guard exists).
Diffstat (limited to 'tools')
-rwxr-xr-xtools/guest-diag/pin_sem_fast.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/guest-diag/pin_sem_fast.sh b/tools/guest-diag/pin_sem_fast.sh
new file mode 100755
index 0000000..e0e30f8
--- /dev/null
+++ b/tools/guest-diag/pin_sem_fast.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# pin_sem_fast.sh - low-latency tracker-sem pinner (2 s poll vs 15 s).
+#
+# Pins the client tracker-sem page (0x20400f000, covers 0x20400fec0..ff70)
+# for the live cdt pid the moment the guest pagemap shows it present, once
+# per pid. The window matters: in the one boot where UVM's page-table write
+# pushes were submitted, the pin had landed ~40 s before the client's
+# internal deadline; later pins (60 s+) lose the race and the client dies
+# without ever submitting the writes.
+#
+# Usage: tools/guest-diag/pin_sem_fast.sh [iterations] (default 200, ~7 min)
+set -u
+cd "$(dirname "$(readlink -f "$0")")/../.."
+EXEC() { timeout 20 ./scripts/vgpu_vm.py exec --timeout 15 "$1" 2>/dev/null; }
+
+B64=$(base64 -w0 tools/guest-diag/guest_pmap_all.py)
+EXEC "echo '$B64' | base64 -d > /tmp/pmapall.py" >/dev/null
+
+N=${1:-200}
+pinned_pid=""
+for ((i = 1; i <= N; i++)); do
+ pid=$(EXEC 'pgrep -x cdt | head -1' | tail -1)
+ if [ -n "$pid" ] && [ "$pid" != "$pinned_pid" ]; then
+ line=$(EXEC "sudo python3 /tmp/pmapall.py $pid 0x20400f000 1" |
+ grep -aE "^0x20400f000,0x[0-9a-f]+$" | head -1)
+ if [ -n "$line" ]; then
+ echo "$line,0x1000,1" | sudo tee /sys/module/open_iov_vfio/parameters/sema_map_add >/dev/null
+ pinned_pid="$pid"
+ echo "[$((i * 2))s] pinned $line (pid $pid)"
+ fi
+ fi
+ sleep 2
+done \ No newline at end of file