From 7bd40d21aca586e4882d83561d23c678f20d659e Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 26 Jul 2020 23:38:39 -0400 Subject: [PATCH 1/9] add DSEreset.bat --- DSEreset.bat | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 DSEreset.bat diff --git a/DSEreset.bat b/DSEreset.bat new file mode 100644 index 0000000..74e010a --- /dev/null +++ b/DSEreset.bat @@ -0,0 +1,12 @@ +:: disable driver signature enforcement +:: relies on https://github.com/Mattiwatti/EfiGuard +C:\Users\e\FreeSLI-dist\tools\EfiDSEFix.exe -d +:: let it soak +TIMEOUT /T 2 +:: reset the devices, load the unsigned drivers +C:\Users\e\FreeSLI-dist\tools\devcon.exe disable "PCI\VEN_10DE&DEV_1E87&SUBSYS_21833842" +C:\Users\e\FreeSLI-dist\tools\devcon.exe enable "PCI\VEN_10DE&DEV_1E87&SUBSYS_21833842" +:: re-enable driver signature enforcement +TIMEOUT /T 2 +C:\Users\e\FreeSLI-dist\tools\EfiDSEFix.exe -e +PAUSE \ No newline at end of file From c252f2e1d3b27cff6c11590e9eb999bc7545ffb4 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Thu, 24 Sep 2020 20:33:09 -0500 Subject: [PATCH 2/9] update comments, require less sudo --- start-win10 | 70 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/start-win10 b/start-win10 index 0fde060..274e894 100755 --- a/start-win10 +++ b/start-win10 @@ -1,50 +1,64 @@ #!/bin/bash -# requires `cset` +# +# script to create cpusets to isolate CPU threads for KVM/libvirt VMs +# requires 'cset' # available on Fedora through my COPR: # - https://copr.fedorainfracloud.org/coprs/jlay/cpuset/ -# review notes regarding XML entries - +# review comments below regarding CPUs and XML entries +# # this script: # - isolates host tasks from the VM CPUs # - applies some generic tweaks # - resets host isolation on VM shutdown - -# Set the range of cores assigned to the windows VM -# on an i9-7920x this is the first 8 cores and the corresponding hyperthreads -VM_CORES='0-7,12-19' - -# based on the assignments of pinned CPUs in libvirt XML, eg: +# +# define the CPUs (cores/threads) to isolate for the VM +VM_CORES='0-11,24-35' +# Tip: refer to 'virsh capabilities | grep siblings' +# this will show CPU topology information for the host +# allows one to pick optimal layout for the VM +# +# the pinned CPUs are definend like so in the VM libvirt XML: # -# -# [...] -# -# -# -# `lscpu -e` and `virsh capabilities` are helpful for determining valid pinning settings -# on example system (i9 7920x), vCPUs 0-15 are pinned (alternating between) cores 0-7 and hyperthreads 12-19 - +# +# +# +# [...] +# +# +# NOTE: the pinned emulator CPUs must be included in VM_CORES +# probably any iothreads too +# +# example above is based on a threadripper 3960x: +# - one NUMA node +# - SMT enabled +# # reduce kernel jitter sudo sysctl vm.stat_interval=120 sudo sysctl kernel.watchdog=0 -# isolate VM CPUs from host tasks -# VM must have the partition cset uses w/ userset below defined in libvirt XML, eg: -# -# ... reference line -# -# /windows10 -# -# ... reference line - -# first, attempt to reset shielding. we want to recreate conflicting names with set params +# attempt to reset shielding, we want to create it with current params +# and remove any existing slices from previous VM boots +# 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 cset set -d windows10.slice # shield cores +# userset slice must match the partition defined in libvirt xml, eg: +# +# +# +# /windows10 +# +# 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 -sudo virsh start windows10 +virsh start windows10 # set higher priority QEMU_PID=$(sudo ps fauxww | awk '$0 ~ /qemu.*windows1[0]/ {print $2}') From 82b6aded6f5c2d68180d47cd53e042f732c9b83e Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Thu, 24 Sep 2020 21:32:56 -0500 Subject: [PATCH 3/9] update comments and topology --- start-win10 | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/start-win10 b/start-win10 index 274e894..aa69043 100755 --- a/start-win10 +++ b/start-win10 @@ -12,7 +12,7 @@ # - resets host isolation on VM shutdown # # 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' # this will show CPU topology information for the host # allows one to pick optimal layout for the VM @@ -33,14 +33,12 @@ VM_CORES='0-11,24-35' # - SMT enabled # # reduce kernel jitter -sudo sysctl vm.stat_interval=120 -sudo sysctl kernel.watchdog=0 +sudo sh -c 'sysctl vm.stat_interval=120 ; sysctl kernel.watchdog=0' # attempt to reset shielding, we want to create it with current params # and remove any existing slices from previous VM boots # 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 cset set -d windows10.slice +sudo sh -c 'cset shield --reset --sysset=host.slice --userset=windows10.slice ; cset set -d windows10.slice' # shield cores # userset slice must match the partition defined in libvirt xml, eg: @@ -52,26 +50,30 @@ sudo cset set -d 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 virsh start windows10 -# set higher priority -QEMU_PID=$(sudo ps fauxww | awk '$0 ~ /qemu.*windows1[0]/ {print $2}') -sudo renice -20 -p ${QEMU_PID} -sudo chrt -f -p 99 ${QEMU_PID} +# determine QEMU vCPU PIDs +QEMU_PIDS=$(sudo egrep 'vcpu.*pid' /var/run/libvirt/qemu/windows10.xml | cut -d\' -f4) + +# 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" while true; do # chill a bit sleep 10 # get vm state, check if it's off - VM_STATE=$(sudo virsh dominfo windows10 | awk '$1 ~ /State/ {print $NF}') - if [ "$VM_STATE" == 'off' ]; then + if test -f "/var/run/libvirt/qemu/windows10.xml"; 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" sudo cset shield --reset --sysset=host.slice --userset=windows10.slice exit 0 From 48cc31a648750f111e359203338a5d7dc8e2631a Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Mon, 9 Nov 2020 16:26:18 -0600 Subject: [PATCH 4/9] add updated XML, post threadripper upgrade --- windows10-threadripper-pinning.xml | 364 +++++++++++++++++++++++++++++ 1 file changed, 364 insertions(+) create mode 100644 windows10-threadripper-pinning.xml diff --git a/windows10-threadripper-pinning.xml b/windows10-threadripper-pinning.xml new file mode 100644 index 0000000..5279d54 --- /dev/null +++ b/windows10-threadripper-pinning.xml @@ -0,0 +1,364 @@ + + windows10 + ebe29b71-9205-4032-9880-9a02bdf2cc2e + + + + + + 33554432 + 33554432 + + + + + + 32 + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /windows10 + + + hvm + /usr/share/edk2/ovmf/OVMF_CODE.fd + /var/lib/libvirt/qemu/nvram/windows10_VARS.fd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + destroy + restart + destroy + + + + + + /usr/bin/qemu-system-x86_64 + + + + + +
+ + + + + + +
+ + + + + +
+ + +
+ + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + +
+ + +
+ + + + + + +
+ + + + + + + + + + + +
+ + + + +
+ + + + + + +
+ +