update comments and topology

This commit is contained in:
Josh Lay 2020-09-24 21:32:56 -05:00
parent 139b65a2cd
commit 82b6aded6f

View file

@ -12,7 +12,7 @@
# - resets host isolation on VM shutdown # - resets host isolation on VM shutdown
# #
# define the CPUs (cores/threads) to isolate for the VM # define the CPUs (cores/threads) to isolate for the VM
VM_CORES='0-11,24-35' VM_CORES='0-19,24-43'
# Tip: refer to 'virsh capabilities | grep siblings' # Tip: refer to 'virsh capabilities | grep siblings'
# this will show CPU topology information for the host # this will show CPU topology information for the host
# allows one to pick optimal layout for the VM # allows one to pick optimal layout for the VM
@ -33,14 +33,12 @@ VM_CORES='0-11,24-35'
# - SMT enabled # - SMT enabled
# #
# reduce kernel jitter # reduce kernel jitter
sudo sysctl vm.stat_interval=120 sudo sh -c 'sysctl vm.stat_interval=120 ; sysctl kernel.watchdog=0'
sudo sysctl kernel.watchdog=0
# attempt to reset shielding, we want to create it with current params # attempt to reset shielding, we want to create it with current params
# and remove any existing slices from previous VM boots # and remove any existing slices from previous VM boots
# we want it to be created with current params, such as possibly-changed pinned CPUs # we want it to be created with current params, such as possibly-changed pinned CPUs
sudo cset shield --reset --sysset=host.slice --userset=windows10.slice sudo sh -c 'cset shield --reset --sysset=host.slice --userset=windows10.slice ; cset set -d windows10.slice'
sudo cset set -d windows10.slice
# shield cores # shield cores
# userset slice must match the partition defined in libvirt xml, eg: # userset slice must match the partition defined in libvirt xml, eg:
@ -52,26 +50,30 @@ sudo cset set -d windows10.slice
# <os> # <os>
sudo cset shield -c $VM_CORES --sysset=host.slice --userset=windows10.slice sudo cset shield -c $VM_CORES --sysset=host.slice --userset=windows10.slice
# setup looking glass
#sudo touch /dev/shm/looking-glass
#sudo chown jlay:kvm /dev/shm/looking-glass
#sudo chmod 660 /dev/shm/looking-glass
# start the VM # start the VM
virsh start windows10 virsh start windows10
# set higher priority # determine QEMU vCPU PIDs
QEMU_PID=$(sudo ps fauxww | awk '$0 ~ /qemu.*windows1[0]/ {print $2}') QEMU_PIDS=$(sudo egrep 'vcpu.*pid' /var/run/libvirt/qemu/windows10.xml | cut -d\' -f4)
sudo renice -20 -p ${QEMU_PID}
sudo chrt -f -p 99 ${QEMU_PID} # set higher priority for vCPU PIDs
sudo renice -20 -p ${QEMU_PIDS}
# either of these attempts at real time seem to freeze on boot
# try a different kernel (not 5.8.11)
#for CPUPID in ${QEMU_PIDS}; do
## sudo chrt -f -p 99 ${CPUPID}
# sudo chrt -r -p 99 ${CPUPID}
#done
echo "Waiting for windows10 VM to stop before resetting cpusets" echo "Waiting for windows10 VM to stop before resetting cpusets"
while true; do while true; do
# chill a bit # chill a bit
sleep 10 sleep 10
# get vm state, check if it's off # get vm state, check if it's off
VM_STATE=$(sudo virsh dominfo windows10 | awk '$1 ~ /State/ {print $NF}') if test -f "/var/run/libvirt/qemu/windows10.xml"; then
if [ "$VM_STATE" == 'off' ]; then VM_STATE="on" # doesn't do much (yet?), just here to fill a spot
else
VM_STATE="off"
echo -e "windows10 VM shut down, setting cpusets back to normal\n" echo -e "windows10 VM shut down, setting cpusets back to normal\n"
sudo cset shield --reset --sysset=host.slice --userset=windows10.slice sudo cset shield --reset --sysset=host.slice --userset=windows10.slice
exit 0 exit 0