summaryrefslogtreecommitdiffstats
path: root/tools/guest-diag/vmrestart.sh
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-24 01:58:15 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-24 01:58:15 -0400
commit3b9432714a0515b89309ff2e6c1983690fb67761 (patch)
tree6ee1d2c33c6f0868e1f5316c2f2c9d6347a01f7f /tools/guest-diag/vmrestart.sh
parentdb34d52120055c927aad160b2c73c390485333ea (diff)
downloadopen-iov-3b9432714a0515b89309ff2e6c1983690fb67761.tar.gz
open-iov-3b9432714a0515b89309ff2e6c1983690fb67761.zip
kernel: validate learned semaphore maps and post guest GPU events
- admit {GPU VA -> PA} pairs only when the preceding bytes form a valid client memory descriptor header (type 0/1, CPU+GPU mapped bits), prefer validated pairs over headerless candidates under first-wins dedup, and invalidate the translation cache on every rebuild; fixes stale identity entries shadowing live pool pages and lets the guest UVM channel bring-up complete on its own - capture OS event allocations (class 0x79) and post event records (function 0x1003) into the guest status queue when a channel's busy notification is consumed, with a broadcast fallback, serialized with replies via a queue lock - add BAR0 shadow introspection (dump_bar0/scan_bar0) and guest-side diagnostic scripts for the VM cycle
Diffstat (limited to 'tools/guest-diag/vmrestart.sh')
-rwxr-xr-xtools/guest-diag/vmrestart.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/guest-diag/vmrestart.sh b/tools/guest-diag/vmrestart.sh
new file mode 100755
index 0000000..dbe60ec
--- /dev/null
+++ b/tools/guest-diag/vmrestart.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# vmrestart.sh - stop QEMU, reload open-iov-vfio.ko from the tree, fresh mdev,
+# relaunch the vGPU VM. Everything bounded so a stuck step cannot hang the
+# caller.
+set -u
+cd "$(dirname "$(readlink -f "$0")")/../.."
+
+sudo pkill -f qemu-system-x86_64 2>/dev/null
+sleep 4
+sudo rm -f /tmp/qemu-guest-agent.sock /tmp/qemu-qmp.sock
+
+for m in /sys/bus/mdev/devices/*; do
+ [ -d "$m" ] || continue
+ timeout 20 sudo sh -c "echo 1 > $m/remove" || echo "WARN: mdev remove timeout"
+done
+
+timeout 30 sudo rmmod open_iov_vfio || { echo "ERROR: rmmod failed"; exit 1; }
+sudo insmod kernel/open-iov-vfio.ko || { echo "ERROR: insmod failed"; exit 1; }
+
+U=$(uuidgen)
+echo "$U" | sudo tee /sys/class/mdev_bus/0000:01:00.0/mdev_supported_types/nvidia-nvidia-vgpu-turing/create >/dev/null
+sed -i "s|/sys/bus/mdev/devices/[0-9a-f-]*|/sys/bus/mdev/devices/$U|" tools/guest-diag/launch_qemu_rootport.run.sh
+mkdir -p /tmp/sockets/e726ba0b-204f-4ec9-91da-983ed7f41d06
+
+(setsid nohup tools/guest-diag/launch_qemu_rootport.run.sh > tools/guest-diag/run/qemu.log 2>&1 &)
+sleep 6
+if pgrep -f qemu-system-x86_64 >/dev/null; then
+ echo "VM up (mdev $U)"
+else
+ echo "VM FAILED"; tail -5 tools/guest-diag/run/qemu.log; exit 1
+fi