AMD’s Threadripper platform has proven buggy and problematic for Passthrough VMs. Luckily, Geoffrey McRae, known by his username gnif, recently submitted a fix to the Linux kernel developers for the company’s HEDT flagship. When the patch lands downstream, TR will be uniquely poised as a powerful virtualization platform, as the highest-end Threadripper currently available sports 16 cores and 32 threads.
PCI Passthrough users have long been skeptical about Threadripper’s PCI bus. Among the first to raise concerns was the Reddit member “abriasffxi.” His claims were that the entire PCI bus crippled after attempting to pass a PCI device to a virtual machine. This included USB, SATA, and all other PCI devices including GPUs and sound cards.
Gnif, the patch’s author, is well known for his work on Looking Glass. Looking Glass is an application that streams a Windows guest’s desktop to a Linux host. He is also well known for finding a fix for the AMD nested page tables bug. The bug caused drastic performance drops in many workloads, including gaming.
Gnif submitted the patch, which improves core parts of Linux’s PCI driver, on Wednesday. At the time of writing, kernel maintainers have not yet accepted the patch. It works by re-loading the PCI bridge configuration when the bridge resets. Most platforms do not need this, but it appears that Threadripper is an exception. Gnif’s code does not only apply to Threadripper, but to all PCI-supporting machines. Alex Williamson, the maintainer of the vfio-pci kernel module and PCI Passthrough support in QEMU, said, “Maybe it can be handled via a quirk if AMD isn’t planning to release firmware that resolves this issue?”
Before the release of this patch, Redditor “HyenaCheeseHeads” released a workaround. The 114-line Java application watches the /sys directory for devices connected to vfio-pci. When PCI devices disconnect from the host, it rewrites the bridge configuration. Despite the quick and dirty nature of the hack, it did work around the problem.
Applying the patch
Currently one must recompile their kernel to apply the patch. Most distros have an easy way to do this. Users of Debian (and derivatives) can patch the kernel and build a deb file. Users of Arch Linux can add a patch instruction to their Linux PKGBUILD. The Arch Wiki contains useful information on this process. Gentoo users can add the patch file to their Portage patch directory and re-compile. Fedora users can follow the Fedora Wiki’s guide. Users of other distributions can find information on their distro’s wiki.
Join our Discord to chat with other readers and our writers
Images courtesy PixaBay