March 29. 2020 edit: Recently I published a tutorial using Virtual Machine Manager. You can find it here: Creating a Windows 10 VM on the AMD Ryzen 9 3900X using Qemu 4.0 and VGA Passthrough.
Before you get your hopes high, this post is not (yet?) a tutorial on creating a Windows 10 virtual machine using the Virtual Machine Manager (virt-manager) GUI. It should have been, though. I spent the better part of a week trying to configure and install a Windows 10 VM that delivers the performance that I’m used to.
As it turns out, it was a failure. Don’t get me wrong, I did manage to configure and run Windows using virt-manager and virsh. I even installed it multiple times, changing the configuration to what I hoped would improve performance. But whatever I tried, I never got even near the speed and snappiness that I achieve by following my tutorial using a start script.
Many users – myself included – rather prefer the comfort of a graphical user interface with check boxes and pull-down menus to select the various options. I’ve listed some tutorials using the virt-manager at the end, for those who came to find a solution.
For almost 2 1/2 years I’ve been a happy camper with KVM and VGA passthrough. But lately I noticed a performance drop inside the VM, specifically 2D graphics performance.
Later it turned out that the performance drop was related to a Microsoft Windows firmware update to mitigate the Spectre vulnerability.
Before I discovered the cause, I thought I might as well try out libvirt with virt-manager. I had recently upgraded the host to Linux Mint 19 (Ubuntu 18.04 based) doing a fresh install. Much has been updated, and this time Linux Mint actually ships with the latest virt-manager release.
My Hardware & Software Setup
It’s important to be precise about the system and the software that is used, especially when it comes to virtualization. Here is my hardware and software configuration that I used for virt-manager/libvirt based VGA passthrough.
- Intel i7 3930k 6-core CPU with hyperthreading (12 threads total)
- Asus Sabertooth X79 motherboard with latest BIOS release 4801
- Gigabyte / Nvidia Geforce GTX970 GPU for passthrough (with UEFI BIOS)
- PNY / Nvidia Quadro 2000 GPU for host (legacy BIOS)
- Samsung EVO 860 1TB SATA-3 SSD for Windows VM
- 24 GB RAM (16GB for Windows VM)
- Linux Mint 19 Tara with Mate desktop (based on Ubuntu 18.04 Bionic)
- Kernel: 4.15.0-30
- qemu-system-x86_64: 2.11.1
- libvirt: 4.0.0-1
- virt-manager: 1.5.1-0
- OVMF (UEFI BIOS): 20180205
- Windows 10 Pro 64 bit, release 1803 (latest ISO image as of this writing)
- Virtio drivers: virtio-win-0.1.140.iso
- Nvidia GTX970 graphics driver: 398.82
Trial and Error
I did some research first, cross-referencing qemu scripts and virtlib xml configuration files and reading up on recent developments. A good source of information is the libvirt.org website. While it explains the zillions of xml config file options, it doesn’t give you the grand picture. Always worth reading is the Arch Linux wiki (see link below under “Virtual Machine Manager – Tutorials”). A few helpful hints came from a virt-manager developer.
But in the end it was down to trial and error. First I installed Windows directly onto a new SSD and ran some benchmarks for reference. Then I reformatted the disk and created a storage pool using Virtual Machine Manager (virt-manager) backed by LVM storage.
The easiest part was the passthrough of the graphics card and some USB controllers. Installing Windows is rather time consuming, especially turning off all the nonsense that is shipped and turned on by default.
Once I had all the drivers installed and a system that looked ready for testing, I ran Passmark 8. Below are the results of several different trials (meaning new (re-)installations of Windows), with a comparison to my bare metal Windows installation:
The yellow graph in the middle shows the bare metal performance of Windows, with a Passmark result of 4821.
The purple graph represents benchmarks done on my original VM run by a qemu start script – without virt-manager/libvirt.
The first two graphs (red and blue) and the last graph (green) are different configurations using virt-manager/libvirt, and “fine-tuning” the xml config file. Obviously this hasn’t been very successful.
Tuning the configuration I was able to get some decent results using virt-manager, but not without editing the xml configuration. The whole process is cumbersome, though. It’s definitely a lot quicker to make a change in a qemu script.
Virtual Machine Manager – Pros and Cons
- Features are more in line with the latest qemu/kvm developments
- Latest virt-manager version in Ubuntu 18.04 release (at the time of the release, now the latest virt-manager version is 2.0)
- Improved VM configurability
- Better integration in Ubuntu (dependencies, permissions, etc.)
- VM can be controlled from host using virsh
- Basic options still missing, for example “kvm=off” option
- Interface not intuitive
- Hidden options such as “host-passthrough”
- Network bridge configuration interferes with existing network bridge
- Requires editing cryptic xml configuration file
- xml needs to be edited using vish – a command-line tool that doesn’t offer modern editing tools
- Configuration changes are difficult to implement, often requiring a new VM installation
- virt-manager essentially creates a qemu command line to start the VM, but doesn’t save the configuration in a human readable format
- No transparency in the way virt-manager configures the VM
- Doesn’t keep up with new qemu/kvm features and options
Virtual Machine Manager – Tutorials
Probably most of the VGA passthrough tutorials out on the Internet are now using virt-manager to configure the virtual machine. The following are among the better or more popular ones:
- VFIO GPU How To series (written by a kvm developer)
- Play games in Windows on Linux! PCI passthrough quick guide (includes a Youtube video tutorial)
- GPU passthrough: gaming on Windows on Linux
- Arch Linux | Virt-Manager – Windows 10 KVM with OVMF (video tutorial using Arch Linux)
- PCI passthrough via OVMF (the Arch Linux wiki, an excellent source of information
If you were looking for a VGA passthrough tutorial using the virt-manager GUI, the above links will get you most likely to a working Windows VM (unless your hardware or software doesn’t meet the requirements).