|
|
|
#!/bin/bash
|
|
|
|
echo "Reserving hugepages"
|
|
|
|
echo 8192 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
|
|
|
|
echo 3 | sudo tee /proc/sys/vm/drop_caches
|
|
|
|
echo 1 | sudo tee /proc/sys/vm/compact_memory
|
|
|
|
echo "Starting Network"
|
|
|
|
virsh --connect=qemu:///system net-start default
|
|
|
|
sudo systemctl start smb nmb
|
|
|
|
sleep 2
|
|
|
|
echo "Starting VM"
|
|
|
|
virsh --connect=qemu:///system start win10
|
|
|
|
echo "Starting Scream"
|
|
|
|
scream -o pulse -i virbr0 &
|
|
|
|
echo "Starting Looking Glass"
|
|
|
|
#looking-glass-client -s no -d yes -g egl -a -M no egl:vsync yes &
|
|
|
|
looking-glass-client -s -d -g egl -a -M -K 120 &
|
|
|
|
while [ "$command" != "stop" ]; do
|
|
|
|
if jobs | grep looking | grep Running; then
|
|
|
|
read command
|
|
|
|
else
|
|
|
|
looking-glass-client -s -d -g egl -a -M -K 120 &
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
sudo whoami
|
|
|
|
echo "Stopping VM..."
|
|
|
|
#stop
|
|
|
|
virsh --connect=qemu:///system shutdown win10
|
|
|
|
echo "Killing Looking Glass and Scream..."
|
|
|
|
kill -9 $(jobs -p)
|
|
|
|
vmstate=$(virsh --connect=qemu:///system domstate win10)
|
|
|
|
echo "Waiting for shutdown..."
|
|
|
|
while [ "$vmstate" != "shut off" ]; do
|
|
|
|
sleep 1
|
|
|
|
vmstate=$(virsh --connect=qemu:///system domstate win10)
|
|
|
|
done
|
|
|
|
sleep 1
|
|
|
|
echo "VM is off"
|
|
|
|
echo "Freeing up memory"
|
|
|
|
echo 0 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
|
|
|
|
echo "Unbinding from vfio-pci"
|
|
|
|
unbinddev 0000:01:00.0 0000:01:00.1 0000:01:00.2 0000:01:00.3
|
|
|
|
sleep 1
|
|
|
|
echo "Enabling GPU power management"
|
|
|
|
#sudo modprobe nvidia NVreg_DynamicPowerManagement=0x02
|
|
|
|
sudo sh -c 'echo "\\_SB.PCI0.GPP0.PG00._OFF" > /proc/acpi/call'
|
|
|
|
sleep 2
|
|
|
|
#sudo systemctl start bumblebeed
|
|
|
|
sudo systemctl stop smb nmb
|
|
|
|
sleep 1
|
|
|
|
#clrgpu
|