No, this is the first time I have been involved to this level with something of this nature. I’d appreciate any advice available on this.
That would be great, people have already been generous with donations for the NPT fix already, it really took me by surprise how much interest there is in this. The fist time I looked into PCI passthrough was about 10 years ago on Xen and very broken, I gave up on it quickly when I found that my new motherboard had a broken IOMMU implementation.
I wont say that I am an expert in all this, most of it is self taught. I didn’t even know how KVM worked two weeks ago and spent several days working through the AMD specifications testing each part of the system searching for the problem. I still have a lot to learn about KVM’s inner workings and how things play along with IOMMU.
There are several bugs I would like to fix in Qemu also that are not CPU/Hardware related, such as a bug in the i8042 PS2 controller implementation I am yet to dig into in detail (seems like a race condition, the virtual device has no interlocking and can and does get entered by multiple threads simultaneously).
Are you also the one that did the thing with “laptop gsync panels?” if so I hexedited the driver and was able to confirm that. They shut that down so fast I’m still reeling over it.
I’m not sure how this works, Wendell might know better.
I had the same experience when I realized my 3770k didn’t support IOMMU. Very sad.
Yeah, everyone in my department is running Linux with a windows VM and a 480 or a 580 passed through for proprietary windows stuff and games. When the NPT patch hit patchwork, one of my underlings came running into my office with a huge smile on. You’re a hero in our office.
I compiled a patched Linux kernel just yet! Thanks alot for the guide! I never did it before (because there was no reason )
Tested yet 2 Benchmarks: Unigine Vally: DX11 (high preset, AA off) and Resident Evil 6 Bench Tool: DX9c (all High, AA off)
both on a passthroughed Sapphire RX 560 oc to 1434 MHz CPU and 2GHz VRAM.
Before the Patch:
Unigine ~52 FPS; 2170 Points (min FPS 18,5 / max FPS 103,8)
RE6 BT ~3700 Points
After the Patch:
Unigine ~ 58,4; 2443 Points (min FPS 28,0 / max FPS 107,2)
RE6 BT ~9600 Points
DirectX9c Games got a huuuuugh boost! DX11 Games where always playable but slightly choppy.
Now its veeeery smooth on my System.
Btw. I’m rocking the following System:
Update 2017-11-02:
I have to add: in my case a crucial package was not installed on my Ubuntu to do the Kernel compile. Please take care the package libssl-dev is installed via apt or synpatic package-manager.
I started yesterday a larger benchmark session with a wide varity of DX11, DX9c, DX12 and on Vulkan API Games. I want to compair NPT=1 vs NPT=0 vs Native Windows 10 performance and post my resultes (probably in a new Thread…). I hope some one find it usefull or “entertaining”
Here the list of Games/Benchmarks that i wanne to use (i.g. started to use):
Benchmarks
Unigine Vally (DX11)
Unigine Heaven (DX11)
Unigine Superposition (DX11)
Resident Evil 6 Bechmark Tool (DX9c)
Resident Evil 5 Benchmark 1 (DX9c)
Resident Evil 5 Benchmark 2 (DX9c)
Tomb Raider
Rise of Tomb Raider (DX12)
Steam VR Performance Test
Ashes of the Singularity: Escalation (DX12 and Vulkan)
Now I will not use my RX 560 card for the Passthrough, instead I pass my XFX R9 280x thru my VM. On earlier tests I noticed around 30% performance loss compaired to native use. My RX 560 “only” lost around 10% Performance with the buggy Nested Page Tables (what was quite intresting).
I think I can post the NPT=1 numbers this evening (German Time)…
An update for anyone watching: I made 2 concurrent mistakes while testing the patch, causing me much confusion for an couple of hours. I both failed to apply the patch correctly (first time using a custom kernel) and failed to properly re-enable NPT. This explains why I was experiencing less-than-ideal performance. After remedying these 2 errors performance improved hugely, and I am (more or less ) officially done tinkering. This passthrough thing is now final the solution to all my woes! Benchmarks in this thread: GPU Passthrough Performance Numbers: Ryzen NPT Patch vs Buggy NPT vs Native Windows
Having trouble applying the patch on fedora 27 (trying kernel 4.13.11-301), and I’m out of ideas for on how to fix it. I’m able to compile the kernel on its own, or even just with a working Aur-acs patch. However adding the NTP patch on top of that causes rpmbuild to fail before I even start compiling.
Here are the commands I use to reproduce this
fedpkg clone -a kernel
git checkout -b my_kernel origin/f27
sudo dnf builddep kernel.spec
./scripts/newpatch.sh Aur-acs.patch
./scripts/newpatch.sh ryzen.patch
make release
sudo fedpkg local
pulled the patch from patchwork kernel, and I applied the aur-acs fixes (which compiled just fine on its own). I don’t think its required, but I installed my matching kernel-devel package just in case. (also util-linux)
I’m going to assume I’m missing something obvious, but if you need any more information I can provide it. Sorry if this is an inappropriate thread for this, at this point.
I’m sorry I can’t be of more help - I found this stage challenging too. In the end I downloaded the kernel from kernel.org, applied the patch and built it using variations on Wendell’s commands with help from this page: https://fedoraproject.org/wiki/Building_a_custom_kernel
Perhaps it’s a missing dependency issue? I fear any advice of mine beyond here is likely to cause more harm than good. I recommend reading that Fedora wiki thoroughly though
OK, I think I got it working. I had to use another method to apply the patch (We can pretend I used the “cat | patch” method as described in the fedora wiki and not just gedit like the filthy casual I am). I’ll run some tests tomorrow to see if I really got it working. Maybe I’ll throw together a few benchmarks against the kernel without the ntp patch if I have the time. Thanks for your help.
@dailan post the build log (use pastebin or something similar), it’s very unlikely that anyone here is going to replicate your steps to figure out the error you were getting.
Unless I’m missing something, the build-log doesn’t seem to have any useful information. Here it is. It does, however, point to this code. The warning about unexpanded macros seems to be harmless.
AND just in case, my current ryzen.patch file. If anyone wants any more information, I would be happy to provide it.
I am using my old card GTS 450 for passing through to my Ubuntu VM, but this card suffers from a reset bug. I have tried detaching the card via command line and then shutdown VM, tried rom dump and feed it in the config - nothing helps. Every time I shut down the VM or reboot, I get black screen and I need to reboot host PC.
Is there any way to power cycle PCIe from host command line in order to initialize it more than once?
BTW, I am on Ryzen 1600 and Asus X370-pro with the latest BIOS (1001).