Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| linux:server:windows_vm [2022/09/07 20:57] – add more investigation stuff michaelbromilow | linux:server:windows_vm [2023/09/04 21:08] (current) – add more hyperv enlightenments michaelbromilow | ||
|---|---|---|---|
| Line 30: | Line 30: | ||
| Useful commands to debug some of this: | Useful commands to debug some of this: | ||
| - | * ''# | + | * ''# |
| * Shows how often qemu is executing various functions, '' | * Shows how often qemu is executing various functions, '' | ||
| * There is also one function used for making the switch to guest space and it accounts for all time spent there. On a 4.14 kernel with intel cpu that function is '' | * There is also one function used for making the switch to guest space and it accounts for all time spent there. On a 4.14 kernel with intel cpu that function is '' | ||
| - | * ''# | + | * ''# |
| * This should show the reason a VM is doing '' | * This should show the reason a VM is doing '' | ||
| - | * ''# | + | * ''# |
| * This one should show what the VM is doing? Apparently most time % should be '' | * This one should show what the VM is doing? Apparently most time % should be '' | ||
| + | * High '' | ||
| It may also be a good idea to use '' | It may also be a good idea to use '' | ||
| + | |||
| + | ===== Tweaks for performance ===== | ||
| + | See https:// | ||
| + | |||
| + | ==== CPU Topology & Configuration ==== | ||
| + | Match the host CPU topology with the VM (cores can be changed as desired). Enable '' | ||
| + | |||
| + | <domain type=" | ||
| + | ... | ||
| + | <cpu mode=" | ||
| + | < | ||
| + | </ | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | Add one or more threads dedicated to I/O (libvirt recommends max 1 per core). | ||
| + | |||
| + | <domain type=" | ||
| + | ... | ||
| + | < | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | Set up the vCPUs for the guest by pinning them to the host. See '' | ||
| + | |||
| + | <domain type=" | ||
| + | ... | ||
| + | <vcpu placement=" | ||
| + | < | ||
| + | <vcpupin vcpu=" | ||
| + | <vcpupin vcpu=" | ||
| + | <vcpupin vcpu=" | ||
| + | <vcpupin vcpu=" | ||
| + | <vcpupin vcpu=" | ||
| + | <vcpupin vcpu=" | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | ... | ||
| + | </ | ||
| ==== Enlightenments ==== | ==== Enlightenments ==== | ||
| Line 51: | Line 92: | ||
| < | < | ||
| < | < | ||
| - | <relaxed state='on'/> | + | <relaxed state="on"/> |
| - | <vapic state='on'/> | + | <vapic state="on"/> |
| - | < | + | < |
| - | <vpindex state='on'/> | + | <vpindex state="on"/> |
| - | <synic state='on'/> | + | <runtime state=" |
| - | <stimer state='on'/> | + | <synic state="on"/> |
| - | <reset state='on'/> | + | <stimer state="on"/> |
| + | <reset state="on"/> | ||
| < | < | ||
| < | < | ||
| + | < | ||
| + | < | ||
| + | <ipi state=" | ||
| + | <evmcs state=" | ||
| </ | </ | ||
| </ | </ | ||
| Line 78: | Line 124: | ||
| For me these enlightenments reduced idle CPU by 4-5x (from 45%+ to ~10-12% while running Milestone XProtect in the background, with no cams set up). | For me these enlightenments reduced idle CPU by 4-5x (from 45%+ to ~10-12% while running Milestone XProtect in the background, with no cams set up). | ||
| + | |||
| + | ===== Networking ===== | ||
| + | Modify the netplan configuration to add a bridge, as I understand it the host will now connect via the bridge rather than directly through the interface: | ||
| + | |||
| + | ''/ | ||
| + | < | ||
| + | network: | ||
| + | version: 2 | ||
| + | renderer: networkd | ||
| + | ethernets: | ||
| + | enp2s0: | ||
| + | dhcp4: no | ||
| + | dhcp6: no | ||
| + | #addresses: [192.168.0.20/ | ||
| + | #gateway4: 192.168.0.1 | ||
| + | # | ||
| + | # addresses: [192.168.0.10, | ||
| + | bridges: | ||
| + | br0: | ||
| + | dhcp4: no | ||
| + | dhcp6: yes | ||
| + | addresses: [192.168.0.20/ | ||
| + | gateway4: 192.168.0.1 | ||
| + | nameservers: | ||
| + | addresses: [192.168.0.10, | ||
| + | parameters: | ||
| + | stp: true | ||
| + | forward-delay: | ||
| + | interfaces: | ||
| + | - enp2s0 | ||
| + | </ | ||
| + | |||
| + | Apply with ''# | ||
| + | |||
| + | Configuration to disable netfilter for bridges: | ||
| + | |||
| + | ''/ | ||
| + | < | ||
| + | net.bridge.bridge-nf-call-ip6tables = 0 | ||
| + | net.bridge.bridge-nf-call-iptables = 0 | ||
| + | net.bridge.bridge-nf-call-arptables = 0 | ||
| + | </ | ||
| + | |||
| + | Also ensure '' | ||
| + | |||
| + | ''/ | ||
| + | < | ||
| + | br_netfilter | ||
| + | </ | ||
| + | |||
| + | Apply with:\\ | ||
| + | ''# | ||
| + | ''# | ||
| + | |||
| + | < | ||
| + | FIXME Removed networks and replaced with bridge to device directly. | ||
| + | </ | ||
| + | |||
| + | Create a new network in virt-manager (right click connection, details, virtual networks) and replace the xml with: | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <forward mode=" | ||
| + | <bridge name=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Start it and set it to autostart. Now in guests just set the network to " | ||
| + | |||
| + | ===== Updates ===== | ||
| + | Apparently Windows Server doesn' | ||