diff --git a/docs/GUEST-SETUP.md b/docs/GUEST-SETUP.md index 79cab99..cb0e8cb 100644 --- a/docs/GUEST-SETUP.md +++ b/docs/GUEST-SETUP.md @@ -132,6 +132,31 @@ has an in-box driver for the Intel 82576 it emulates. Do not use virtiofs for ho virtio device the scanner names, and its shared memory backing blocks transparent hugepages for the whole guest. Share over SMB on the `igb` link instead. +### Jumbo frames + +`vm-native-setup` puts `` on the guest interface. The emulated NIC is packet-rate +bound rather than bandwidth bound, so larger frames cut the per-packet cost the guest pays on +receive - the direction that matters when you read files off an SMB share. Measured on igb, host to +guest: 2922 Mbit/s at 1500, 14232 Mbit/s at 9000, byte-for-byte identical either way. + +Both ends have to agree or the frames are simply dropped. The libvirt network needs it too: + +``` +virsh net-edit default # add +virsh net-destroy default && virsh net-start default +``` + +and in the guest, set the adapter's *Jumbo Packet* to 9014 and the interface MTU to 9000: + +```powershell +$n = (Get-NetAdapter -Physical | Where-Object Status -eq 'Up').Name +Set-NetAdapterAdvancedProperty -Name $n -RegistryKeyword "*JumboPacket" -RegistryValue 9014 +Set-NetIPInterface -InterfaceAlias $n -NlMtu 9000 +``` + +Check `Get-NetIPInterface` afterwards: setting *Jumbo Packet* alone leaves the IP MTU at 1500 and +you get none of the benefit. + ## 5. Remove the virtio drivers and the agents Boot the guest. It is on NVMe now, so `viostor` and `vioscsi` can go. In this order, as diff --git a/packaging/vfio-native/PKGBUILD b/packaging/vfio-native/PKGBUILD index b8ed8fc..9efc71a 100644 --- a/packaging/vfio-native/PKGBUILD +++ b/packaging/vfio-native/PKGBUILD @@ -8,7 +8,7 @@ # vfio-native-qemu QEMU 11.1.1 with the platform-identity patches, in /opt pkgname=vfio-native -pkgver=1.2.0 +pkgver=1.3.0 pkgrel=1 pkgdesc="Present a libvirt guest as a self-consistent physical machine, and tune it" arch=('any') diff --git a/scripts/setup-vm.sh b/scripts/setup-vm.sh index 4c32535..c59e107 100755 --- a/scripts/setup-vm.sh +++ b/scripts/setup-vm.sh @@ -661,7 +661,11 @@ if conformant and E["CONVERT"] == "1": s = re.sub(r"\s*", "", s) s = re.sub(r".*?", "", s, flags=re.S) s = re.sub(r"", "", s) - s = re.sub(r"(\s*)?", "", s) + # jumbo frames are the single biggest win on the host<->guest link: the emulated + # NIC is packet-rate bound, so 9000-byte frames cut the per-packet cost the guest + # pays on receive. Measured 2922 -> 14232 Mbit/s inbound on igb, byte-exact clean. + s = re.sub(r"(\s*)?", + "\n ", s) if prof == "full": s = re.sub(r"", "", s, flags=re.S) @@ -831,6 +835,15 @@ if [ ! -e /usr/lib/udev/rules.d/99-vfio-native-vnet-offload.rules ] && [ ! -e /e echo " 'Corrupted MAC on input' until it is:" echo " sudo install -Dm644 $SELF/scripts/99-vfio-native-vnet-offload.rules /etc/udev/rules.d/ && sudo udevadm control --reload-rules" fi + +NET=$("${C[@]}" dumpxml "$DOM" 2>/dev/null | sed -n "s/.*/dev/null | sed -n "s/.* to" + echo " the network and restart it: virsh net-edit $NET && virsh net-destroy $NET && virsh net-start $NET" + echo " Then in the guest: set the NIC's Jumbo Packet to 9014 and the interface MTU to 9000." +fi gov=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null || echo unknown) [ "$gov" = performance ] || echo "host governor is '$gov' - run: sudo cpupower frequency-set -g performance"