Windows 10 on LXD - poor performance

Hey, I’ve created a Windows 10 virtual machine and its performance is slow, the mouse is moving sluggishly. I created Windows 10 VM using this guide: How to run a Windows virtual machine on LXD on Linux. Are there any ways to improve Windows 10 performance?

I’m going to run stuff like Visual Studio, Unity3d on the VM. I have an NVIDIA GeForce GTX 1060 GPU on the host. I use spice display console to access the Windows VM.

Thanks for the answer.

The VGA driver performance on Windows is pretty bad, using RDP gives a far better experience.

Though if you need 3D acceleration on Windows, you’d need a secondary GPU that you can pass to the VM.

Which client do you recommend? What do you think about virt-viewer and Remmina?

virt-viewer is pretty much just SPICE. For RDP, you want something freerdp based, so Remmina or xfreerdp directly.

How can I enable qxl video driver on the Windows VM?

You can’t, LXD only supports virtio devices.
The folks at Red Hat have been working on improving the virtio-gpu driver for Windows quite a lot lately and it should soon get to parity or surpass QXL, but that’s why the VGA performance is sub-optimal compared to running desktop Linux in those VMs.

How can I passthrough GPU to the Windows VM? I have two GPUs, one Intel and second NVIDIA.

So you’d need:

  • Boot your machine with iommu=pt intel_iommu=on passed to the kernel
  • Confirm that the GPU you wish to pass sits in its own IOMMU group (lspci -vmm can be used for that), if it’s not, you may need to physically move your GPU to another slot (if a desktop machine) or find some firmware option to reconfigure things
  • Make sure that your host system isn’t using that GPU (driver shouldn’t be loaded at all)

Once that’s all correct, you can simply pass it to the VM with:

  • lxc config device add VM-NAME gpu1 gpu gputype=physical pci=ADDRESS
1 Like

Do I need to install gpu1 drivers on the VM that I’m going to pass that GPU?

Yeah, that VM will see the physical GPU so will need the appropriate drivers installed.

Do I need to remove NVIDIA drivers related packages from the host and set VIDEO_CARDS from intel nvidia to intel?

You can remove the driver or you can set your distro’s driver blacklist so it doesn’t get loaded. If you have both nvidia and intel on your system and want to passthrough the nvidia GPU, blacklisting both nvidia and nouveau should cause your nvidia GPU to not be claimed by a driver and be available for passthrough.

In recent LXD versions, you can override qemu config to use the old QXL driver (which for now, has better performance): Instance configuration - LXD documentation

After installing windows 10 and this, just add the following snippet to the “config” section of your win10 instance configuration:

raw.qemu.conf: |-
    [device "qemu_gpu"]
    driver = "qxl-vga"

An additional trick to get better performance on windows 10 VM is select “Adjust for best performance” in “Performance Options” of the VM’s control panel.