various ajustements
This commit is contained in:
parent
3fc57c2279
commit
7c4e5b9a17
|
@ -1,6 +1,6 @@
|
||||||
title Archlinux w/ VFIO
|
title Archlinux w/ VFIO
|
||||||
linux /vmlinuz-linux
|
linux /vmlinuz-linux-xanmod
|
||||||
initrd /intel-ucode.img
|
initrd /intel-ucode.img
|
||||||
initrd /initramfs-linux.img
|
initrd /initramfs-linux-xanmod.img
|
||||||
options intel_iommu=on iommu=pt intel_iommu=igfx_off experimental_zcopytx=1 kvm.ignore_msrs=1 acpi_backlight=none root=LABEL=ARCHROOT rw
|
options mitigations=off intel_iommu=on iommu=pt intel_iommu=igfx_off experimental_zcopytx=1 kvm.ignore_msrs=1 acpi_backlight=none root=LABEL=ARCHROOT rw
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ "$1" == "win10" ]; then
|
|
||||||
if [ "$2" == "prepare" ]; then
|
prepare() {
|
||||||
systemctl start vm-usb-helper
|
systemctl start vm-usb-helper
|
||||||
# defrag ram
|
|
||||||
|
echo "Defrag RAM"
|
||||||
echo 1 > /proc/sys/vm/compact_memory
|
echo 1 > /proc/sys/vm/compact_memory
|
||||||
for _ in $(seq 5); do
|
for _ in $(seq 5); do
|
||||||
sleep 3
|
sleep 3
|
||||||
|
@ -10,9 +11,54 @@ if [ "$1" == "win10" ]; then
|
||||||
sysctl -w vm.nr_hugepages=8192 && break
|
sysctl -w vm.nr_hugepages=8192 && break
|
||||||
done
|
done
|
||||||
sleep 10
|
sleep 10
|
||||||
fi
|
|
||||||
if [ "$2" == "release" ]; then
|
echo "Setup cpuset cgroup for host"
|
||||||
|
sudo cset set -c 0,4 -s system
|
||||||
|
sudo cset proc -m -f root -t system
|
||||||
|
sudo cset proc -k -f root -t system --force
|
||||||
|
|
||||||
|
echo "Setup cpumask"
|
||||||
|
for i in /sys/devices/virtual/workqueue/*/cpumask; do
|
||||||
|
sudo sh -c "echo 001 > $i"
|
||||||
|
done;
|
||||||
|
|
||||||
|
echo "Setup interrupt affinity"
|
||||||
|
for i in $(sed -n -e 's/ \([0-9]\+\):.*vfio.*/\1/p' /proc/interrupts); do
|
||||||
|
sudo sh -c "echo 0,4 > /proc/irq/$i/smp_affinity_list"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Set the CPU frequency governor to performance"
|
||||||
|
for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
|
||||||
|
echo performance >$f
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
release() {
|
||||||
|
echo "Restore system"
|
||||||
|
# irq
|
||||||
|
for i in $(sed -n -e 's/ \([0-9]\+\):.*vfio.*/\1/p' /proc/interrupts); do
|
||||||
|
sudo sh -c "echo ff > /proc/irq/$i/smp_affinity"
|
||||||
|
done
|
||||||
|
# cpumask
|
||||||
|
for i in /sys/devices/virtual/workqueue/*/cpumask; do
|
||||||
|
sudo sh -c "echo ff > $i"
|
||||||
|
done;
|
||||||
|
# cpuset
|
||||||
|
sudo cset set -d system &>/dev/null
|
||||||
|
|
||||||
|
for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
|
||||||
|
echo powersave >$f
|
||||||
|
done
|
||||||
|
|
||||||
systemctl stop vm-usb-helper
|
systemctl stop vm-usb-helper
|
||||||
sysctl -w vm.nr_hugepages=0
|
sysctl -w vm.nr_hugepages=0
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$1" == "win10" ]; then
|
||||||
|
if [ "$2" == "prepare" ]; then
|
||||||
|
prepare
|
||||||
|
fi
|
||||||
|
if [ "$2" == "release" ]; then
|
||||||
|
release
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -73,8 +73,9 @@
|
||||||
<timer name='tsc' present='yes' mode='native'/>
|
<timer name='tsc' present='yes' mode='native'/>
|
||||||
</clock>
|
</clock>
|
||||||
<on_poweroff>destroy</on_poweroff>
|
<on_poweroff>destroy</on_poweroff>
|
||||||
<on_reboot>restart</on_reboot>
|
<!-- Because of the reset bug, we cannot actually restart without restarting the host -->
|
||||||
<on_crash>restart</on_crash>
|
<on_reboot>destroy</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
<pm>
|
<pm>
|
||||||
<suspend-to-mem enabled='no'/>
|
<suspend-to-mem enabled='no'/>
|
||||||
<suspend-to-disk enabled='no'/>
|
<suspend-to-disk enabled='no'/>
|
||||||
|
@ -171,17 +172,18 @@
|
||||||
</interface>
|
</interface>
|
||||||
<input type='mouse' bus='ps2'/>
|
<input type='mouse' bus='ps2'/>
|
||||||
<input type='keyboard' bus='ps2'/>
|
<input type='keyboard' bus='ps2'/>
|
||||||
|
<graphics type='spice' autoport='yes' defaultMode="insecure" listen="127.0.0.1" port="5900">
|
||||||
|
<listen type='address' address="127.0.0.1"/>
|
||||||
|
</graphics>
|
||||||
<sound model='ich9'>
|
<sound model='ich9'>
|
||||||
<address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
|
||||||
</sound>
|
</sound>
|
||||||
<!--
|
|
||||||
<hostdev mode='subsystem' type='pci' managed='yes'>
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
<source>
|
<source>
|
||||||
<address domain='0x0000' bus='0x00' slot='0x1f' function='0x6'/>
|
<address domain='0x0000' bus='0x00' slot='0x1f' function='0x6'/>
|
||||||
</source>
|
</source>
|
||||||
<address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
|
||||||
</hostdev>
|
</hostdev>
|
||||||
-->
|
|
||||||
<hostdev mode='subsystem' type='pci' managed='yes'>
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
<source>
|
<source>
|
||||||
<address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
|
<address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
|
||||||
|
@ -215,6 +217,7 @@
|
||||||
<qemu:arg value='input-linux,id=kbd1,evdev=/dev/input/by-path/platform-i8042-serio-0-event-kbd,grab_all=off,repeat=on'/>
|
<qemu:arg value='input-linux,id=kbd1,evdev=/dev/input/by-path/platform-i8042-serio-0-event-kbd,grab_all=off,repeat=on'/>
|
||||||
<!-- audio passthrough -->
|
<!-- audio passthrough -->
|
||||||
<qemu:arg value='-audiodev'/>
|
<qemu:arg value='-audiodev'/>
|
||||||
<qemu:arg value='pa,id=pa1,server=/run/user/1000/pulse/native'/>
|
<qemu:arg value="driver=pa,id=hda,server=/run/user/1000/pulse/native,out.buffer-length=2000,timer-period=1000"/>
|
||||||
|
<!-- <qemu:arg value="driver=pa,id=hda,server=127.0.0.1,out.buffer-length=2000,timer-period=1000"/> -->
|
||||||
</qemu:commandline>
|
</qemu:commandline>
|
||||||
</domain>
|
</domain>
|
||||||
|
|
|
@ -89,11 +89,18 @@
|
||||||
dest: /etc/libvirt/hooks/qemu
|
dest: /etc/libvirt/hooks/qemu
|
||||||
mode: '755'
|
mode: '755'
|
||||||
|
|
||||||
- name: configure systemd CPUAffinity
|
# - name: configure systemd CPUAffinity
|
||||||
|
# lineinfile:
|
||||||
|
# path: /etc/systemd/system.conf
|
||||||
|
# regexp: '^#?CPUAffinity'
|
||||||
|
# line: 'CPUAffinity=0 4'
|
||||||
|
|
||||||
|
- name: configure pulseaudio tcp socket
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: /etc/systemd/system.conf
|
path: /etc/pulse/default.pa
|
||||||
regexp: '^#?CPUAffinity'
|
regexp: '^#?load-module module-native-protocol-tcp'
|
||||||
line: 'CPUAffinity=0 4'
|
line: 'load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1'
|
||||||
|
|
||||||
|
|
||||||
- name: enable libvirtd.socket
|
- name: enable libvirtd.socket
|
||||||
systemd:
|
systemd:
|
||||||
|
|
Loading…
Reference in New Issue