this post was submitted on 21 Sep 2023
62 points (95.6% liked)

Linux

48655 readers
1372 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I've been wanting to make a proper switch over to Linux for a while now. I've currently have a dual-boot setup but still mostly use Windows. The majority of my games should work without fuss, but I'd like to have a simple solution for running the handful of things that don't work in Linux, such as my WMR VR headset and a handful of Steam games.

Linked is a video on Single GPU passthrough with KVM/VFIO, which I'd like to try.

Before I try this, I'd like a sense of how likely it is to work, and I'm wondering if there might be a better solution I don't know of. I'm also open to any tips you might have about speeding up the transition between Host/Guest OS.

Here are the specs of my machine:

Motherboard: MSI B550 A-Pro

CPU: AMD Ryzen 7 3700X (no integrated graphics)

GPU: Nvidia GeForce RTX 3070

RAM: 32GB DDR4 3200MHz

Host OS: Manjaro

Guest OS: Windows 10 Pro

all 18 comments
sorted by: hot top controversial new old
[–] a_fancy_kiwi 11 points 1 year ago (1 children)

I did it a few years ago, although I had an AMD GPU.

It works surprisingly well but games that require anti-cheat software (ex. Valorant) won’t work.

The only other good solution that wasn’t mentioned in your post is to just buy and maintain a dedicated windows box. Short of that, GPU passthrough is a great option

[–] whileloop 10 points 1 year ago (1 children)

The only games that have anti-cheat on them actually support Linux anyway, just CS:GO. Not to mention, 77% of my hours in Steam games were spent in games that support Linux natively. 91% in games with ProtonDB scores Gold or better.

[–] [email protected] 2 points 1 year ago (2 children)

How did you get those percentages? I'm curious to know what they are for me

[–] [email protected] 3 points 1 year ago

This can be obtained from ProtonDB, once you've signed in then click the the "Dashboard" tab!

[–] whileloop 2 points 1 year ago

I used ProtonDB. You can log in with your Steam account and it will show the rating for each of your games, along with how many hours they are. It won't give the percentages for you, I had to calculate those myself, but the site got me 80% of the way there.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago)

I currently have a VFIO setup and it works great. There's just almost nothing I need it for with how great Proton has become. I have an AMD APU and GPU. My Linux desktop runs on the APU and only offloads to the discrete GPU when invoked with the DRI_PRIME=1 environment variable.

Virt-Manager has the ability to run scripts at certain points in the VM startup and shutdown process. This is what I use to reassign the GPU to the VFIO stub driver so it can be handed to Windows, remove half of my CPU cores from the process scheduler so Windows isn't suffering constant cache misses, and open looking-glass which uses a shared memory device to render the GPU output in a window on my desktop with minimal latency. Scream starts on login to handle audio, and you're going to want to use a shared memory device for that because it has latency problems over network.

I've been told I have one foot in each bucket labeled "single GPU passthrough" and the other labeled "dual GPU passthrough". If you've only got one you'll have to exit your X or Wayland session to use the VM because your GPU cannot abide two masters. Nvidia has a functional equivalent to Prime, I think, but I don't think it just works out of box. I understand Nvidia isn't happy about their consumer cards being handed to VMs as it's usually an expensive enterprise trick, so there might be a workaround process there.

The Arch wiki has a great tutorial on GPU passthrough using VFIO and OVMF, that's probably your best bet on an arch based system like Manjaro.

[–] [email protected] 4 points 1 year ago

I'm not going to watch the video, but what's the procedure for switching between Linux and Windows? Usually you dedicate a GPU entirely to VFIO, with a 2nd GPU for the host OS (or run headless).

Anyway, will it work? Yes, minus some anti-cheat software. Will it be a simple solution? Well, once you get things stable, yes. The tech behind this is mature, but it can be a rabbit hole.

I would look into a non-Nvidia GPU for your 2nd PCIe x16 slot (x4, shared with the 2nd M.2 slot FYI). Good idea to check IOMMU groups before buying anything, but modern AMD motherboards are usually fine. Blacklist the Nvidia drivers and dedicate the 3070 to VFIO to make your life easier, and run Linux off the secondary GPU. Intel A380 might be a good choice. Do gaming stuff on Windows and stream via Parsec/Looking Glass/Moonlight+Sunshine; everything else on Linux.

[–] [email protected] 3 points 1 year ago

i am writing this message from a single gpu vfio setup

[–] [email protected] 3 points 1 year ago (1 children)

I do this for testing graphics code on different OS/GPU combos - I have an AMD and Nvidia GPU (hoping to add an Intel one eventually) which can each be passed through to Windows or Linux VMs as needed. It works like a charm, with the only minor issue being that I have to use separate monitors for each because I can't seem to figure out how to get the GPU output to be forwarded to the virt-manager virtual console window.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

I don't know if you can do it in software with passthrough, as the guest controls the hardware and would need to coordinate things.

Using a KVM would be a hardware solution that would permit for one monitor, though.

[–] [email protected] 2 points 1 year ago (1 children)

I considered a KVM or something similar, but I still need access to the host machine in parallel (ideally side-by-side so I can step through the code running in the guest from a debugger in my dev environment on the host). I've already got a multi-monitor setup, so dedicating one of them to a VM while testing stuff isn't too much of a big deal - I just have to keep track of whether or not my hands are on separate keyboard+mouse for the guest :)

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Ah, I gotcha. One keyboard/mouse, VM guest output in a window on the host would be ideal.

Run a VNC or RDP server on the guest VM, connect with a client on the host? That won't have quite the performance -- if you're debugging a 3d game and playing it as part of it, you'll get latency, so that won't be a good solution for OP -- but that may not matter for your use case.

[–] [email protected] 2 points 1 year ago

I have almost the same setup hardware wise. I got an RX550 GPU for the host, or sub in any cheap graphics card. If you have the spare slot and lanes its much nicer of an experience to have 2 GPUs. Plug a dummy plug into the guest GPU with looking glass set up and its great! :)

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

I now have two gpus, but I've run single gpu passthrough for a long time without any issues. However, you have to keep in mind that some software (such as anticheat for games) will refuse to run in a virtual machine.

[–] [email protected] 2 points 1 year ago (1 children)

I used to use VFIO several years ago, but these days every game I want to play/ have played recently have all just worked out of the box with Proton. VFIO was always fragile, but it worked great when it did. It has the same problems Proton has with anti-cheat, since its still a VM. So your milage varies depending on the games you want to run.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

That was my experience as well: ran VFIO for a couple years but Proton got good enough that the trouble wasn't worth it.