Return to Level1Techs.com

Help with GPU passthrough


#1

Hi guys!
I was a windows only user for a very long time, i always had a special spot for linux but couldn't switch becouse i need 3D, video edition and graphics design aplications to run with GPU acceleration, i also like to game so using linux was just not possible for me and even when i tried dualbooting i just stayed in windows anyways, but i think it's time for me to finally switch!

I watched the video where Wendell runs GTA V on Arch and i would like to do something like this but i need some help, i have some questions and hoped that somebody could guide me throu the process.

First of all, i don't feel like running Arch, i think i would be able to but that seems like a lot for first time, i have expirience with Ubuntu, Mint, i used BunsenLabs on my netbook for some time now and i also tried Fedora and Debian a bit. What distro should i use? I'm currently thinking about openSUSE but I don't really know the diference betwen most of them, other than dm and de that i would probably customize anyways and packaging format from which mint's seemd to work the better than ubuntu for me. I would like something that suports what i'm doing best.
I found a lot of distro-specific guides that have confusing and conflicting informations, i would love if somebody could link me to a good, tested, updated guide for a distro that you guys think i should use as host for this and help me follow it.
Second, I would like to know what VM software i should use, i want as good performance as possible.
I also would like to know if i have to give an entire monitor to a VM. I have two but i would like to keep it that way, it would be great if i could use both of my monitors under linux and have VM as a window but have the ability to make it fullscreen, you know, like all normal VMs do... but i found some worrying info that you are required to have a separate screen, mouse and keyboard for a VM with passed GPU.
I'm fairly sure my system can do this, i checked as best as i could but if somebody can, please tell me if this would be at all possible on my system:
Intel 4790k
MSI Krait z97s SLI
GTX 970 G1 Gaming
HyperX FURY 1866 CL10 2x8GB
Samsung 850 Evo 250GB + Toshiba 3TB HDD
I don't think the rest of my specs are rellevent but if you want i can post them too. I haven't overclocked any of my parts.

That's all right now but i'm sure i will have more questions later, thanks!


#2

maybe Try antergos? In my experience, getting a gaming VM working and running well is a lot easier on arch or an arch-based system. IF your problem with arch is the obnoxious install process and lack of a default environment (which is totally reasonable,) Antergos fixes that (easy graphical installer, pre-configured desktop stuff out of the box) and gives you access to the nice documentation and the AUR.


#3

Well that and i don't really want to live on the bleeding edge, i don't want my main pc to break becouse an update rolled out, but if that's the best option...


#4

I've been using linux for about a decade, and of the distros I've put into regular use, arch breaks on me far less than ubuntu, mint and the like. most of the breakages are from people setting it up improperly in my experience.

Antergos delivers a competently put together arch installation, so that risk of breaking something on your own is largely mitigated.

Plus, it's just convenient to have a pre-packaged ACS patched kernel, more up-to-date Qemu/libvirt, etc out of the box.


#5

Yeah and a fresh arch install done by me first time is sure to work stable and reliable :D

You say it will be set up properly and i will be able to use/maintain it without much more hassle than let's say mint or fedora)?


#6

As long as you have a sort of up to date kernel (I think the vfio-pci modules got included from kernel 4.2) the process to isolate the gpu is preety much the same for every distro. What could change is the version of qemu or virt-manager.
There is a guide on this forum that uses debian, it's preety well explained, and it will be easier to apply to the distros you're used to.

As for what VM software, I personally use just qemu with a couple of scripts, but if you want a GUI go with virt-manager.

For the monitor, I only have one with two entries, a DVI and an HDMI, I use the hdmi for the GPU and the DVI for the igpu (I'm using intel so I have integrated graphics, but it would be the same if you use 2 dedicated graphic cards).
As for keyboard and mouse you have 3 possibilities, you either passtrhough both to the VM (as long as they are usb), you buy yourself a KVM switch (which you could also use for the monitor, if yours only have one connector), or you could use synergy.
If you do use synergy, I'd recommend setting up the VM without adding the gpu first, just as a regular VM, install synergy on your guest and make sure that it starts on boot and that it works fine, and then add your GPU to the VM.

You could also use the VM virtual monitor (just as your regular VM) and the GPU at the same time, so you can click on your virtual monitor and the VM gets control of the keyboard and mouse, but some people can't use both the virtual monitor and the GPU at the same time, although I don't know why. I used to do this but now I'm using synergy.

Here's that tutorial I mentioned earlier, you should also read the arch wiki guide, I know you said you don't want to use arch, but most of the process applies to every distro, what could change is the packages you'll need to install, those depend on your distro.

https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF

Also, keep in mind that the process, although not hard, might be difficult to someone with not much experience on linux, so be sure to read and clear your doubts before starting so you don't have any troubles along the way.


#7

yep. easy peasy.