INTRODUCTION
GPU passthrough on Ryzen platform has its issues. The most common one, and the one I struggled with the most was a 10 year old bug. The one we will address today. For those who already tried GPU passthrough on ryzen with KVM, you should have noticed a serious performance drop in your guest vs running your GPU on bare metal. This issue could be adressed by using npt=0. This brought along some other issues like not being able to use host-passthrough, the guest only detecting one core, cpu performance loss,… Far from ideal. Last week Geoffrey and Paolo managed to patch this bug. In this article we will be applying the patch and compiling it with the latest linux kernel. (4.14-rc8)
GETTING STARTED
You can use almost any kernel with this patch. I have tested this with kernel 4.10, 4.13 and 4.14-rc8. In this guide, I will be using kernel 4.14-rc8. Kernel 4.14 will be released very shortly as of writing. Linus Torvalds noted that this past week of 4.14 development was fairly quiet and perhaps doesn’t need an “RC8” update, but he opted for it anyways. UPDATE: Kernel 4.14 has been released. Click here to learn how to install and update your kernel.
Getting the kernel
First, we will get the build files for the new kernel.
| |
Creating and applying the patch
The patch can be found here: https://patchwork.kernel.org/patch/10027525/ or copy and paste the patch to a new file npt-ryzen.patch
| |
Now that we have the patch we can apply it to our kernel.
| |
Compiling the new kernel
If all went well, it is time to compile our new patched kernel. Remember, after compiling and installing the new kernel you will have to reboot. Execute the following commands to start compiling the kernel.
| |
Note: this process can take up some time.
Installing the kernel
After the compiling is done you will be left with some .deb files. These are the installation files that we need in order to install the patched kernel.
| |
At this point you are ready to reboot your machine and your system should be ready for GPU passthrough without any performance loss on your KVM guest.