Update hook scripts

This commit is contained in:
2022-03-21 23:10:33 +00:00
parent fc84712083
commit c7b73189cc
3 changed files with 21 additions and 21 deletions

View File

@@ -46,7 +46,7 @@ modprobe -r nvidia
virsh nodedev-detach $VIRSH_GPU_VIDEO virsh nodedev-detach $VIRSH_GPU_VIDEO
virsh nodedev-detach $VIRSH_GPU_AUDIO virsh nodedev-detach $VIRSH_GPU_AUDIO
# Load VFIO kernel module # Load VFIO kernel modules
modprobe vfio modprobe vfio
modprobe vfio_pci modprobe vfio_pci
modprobe vfio_iommu_type1 modprobe vfio_iommu_type1

View File

@@ -5,7 +5,20 @@ set -x
# Load Variables # Load Variables
source "/etc/libvirt/hooks/kvm.conf" source "/etc/libvirt/hooks/kvm.conf"
# Unload VFIO kernel module # Deisolate host
systemctl set-property --runtime -- user.slice AllowedCPUs=0-15
systemctl set-property --runtime -- system.slice AllowedCPUs=0-15
systemctl set-property --runtime -- init.scope AllowedCPUs=0-15
# Enable CPU governor schedutil mode
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "schedutil" > $file; done
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Delete looking glass shm
rm /dev/shm/looking-glass
# Unload VFIO kernel modules
modprobe -r vfio_pci modprobe -r vfio_pci
modprobe -r vfio_iommu_type1 modprobe -r vfio_iommu_type1
modprobe -r vfio modprobe -r vfio
@@ -14,7 +27,7 @@ modprobe -r vfio
virsh nodedev-reattach $VIRSH_GPU_VIDEO virsh nodedev-reattach $VIRSH_GPU_VIDEO
virsh nodedev-reattach $VIRSH_GPU_AUDIO virsh nodedev-reattach $VIRSH_GPU_AUDIO
# Read our nvidia configuration when before starting our graphics # Read our nvidia configuration before starting our graphics
nvidia-xconfig --query-gpu-info > /dev/null 2>&1 nvidia-xconfig --query-gpu-info > /dev/null 2>&1
# Load all Nvidia drivers # Load all Nvidia drivers
@@ -26,18 +39,5 @@ modprobe nvidia
# Dealloc hugepages # Dealloc hugepages
echo 0 > /proc/sys/vm/nr_hugepages echo 0 > /proc/sys/vm/nr_hugepages
## Enable CPU governor schedutil mode
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "schedutil" > $file; done
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Deisolate host
systemctl set-property --runtime -- user.slice AllowedCPUs=0-15
systemctl set-property --runtime -- system.slice AllowedCPUs=0-15
systemctl set-property --runtime -- init.scope AllowedCPUs=0-15
# Delete looking glass shm
rm /dev/shm/looking-glass
# Mount the Windows drive # Mount the Windows drive
mount -a || /bin/true mount -a || /bin/true

View File

@@ -2,15 +2,15 @@
set -x set -x
# Enable CPU governor schedutil mode
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "schedutil" > $file; done
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Deisolate host # Deisolate host
systemctl set-property --runtime -- user.slice AllowedCPUs=0-15 systemctl set-property --runtime -- user.slice AllowedCPUs=0-15
systemctl set-property --runtime -- system.slice AllowedCPUs=0-15 systemctl set-property --runtime -- system.slice AllowedCPUs=0-15
systemctl set-property --runtime -- init.scope AllowedCPUs=0-15 systemctl set-property --runtime -- init.scope AllowedCPUs=0-15
# Enable CPU governor schedutil mode
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "schedutil" > $file; done
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Dealloc hugepages # Dealloc hugepages
echo 0 > /proc/sys/vm/nr_hugepages echo 0 > /proc/sys/vm/nr_hugepages