2024 Linux PC Build

After five years of dual booting both Windows 10 and Linux (Pop!_OS, and then Debian), I decided it was time to come down onto one side of the fence. On one hand I like playing the latest games, so Windows would continue to be an ideal platform. On the other hand, I have been a Linux user for a few years now, and want to try running it as my main operating system. After doing some research, I think I have found the best of both worlds.

PCI Passthrough

PCI passthrough is a technique used to help achieve near-native performance on a virtual machine. The idea is to isolate a graphics card from the host operating system and "pass it" through to a virtual machine as if it were physically installed into it. The Arch Linux Wiki has an excellent article on setting up PCI passthrough for use with QEMU/KVM virtual machines. A number of YouTube videos were helpful to me in setting up my system. I will link them at the bottom of the page.

Part 1: The build

For my specific setup, I am running Fedora 39 as the host operating system with a Windows 11 virtual machine. The base system has 64GB of DDR5 memory, an Intel i9-13900K processor, an AMD RX 7800 XT GPU allocated to Linux, a NVIDIA RTX 4070 GPU allocated to Windows, and 6TB of NVME solid state storage, split between a 2TB boot drive and a 4TB secondary storage drive. See below for a full parts list:

TypeItem
CPUIntel Core i9-13900K 3 GHz 24-Core Processor
CPU CoolerCooler Master Hyper 212 (2023) 70.7 CFM CPU Cooler
MotherboardAsus ROG STRIX Z790-E GAMING WIFI ATX LGA1700 Motherboard
MemoryCorsair Vengeance 64 GB (2 x 32 GB) DDR5-6400 CL32 Memory
StorageSamsung 990 Pro 2 TB M.2-2280 PCIe 4.0 X4 NVME Solid State Drive
StorageSamsung 990 Pro 4 TB M.2-2280 PCIe 4.0 X4 NVME Solid State Drive
Video CardGigabyte WINDFORCE OC GeForce RTX 4070 12 GB Video Card
Video CardGigabyte GAMING OC Radeon RX 7800 XT 16 GB Video Card
Power SupplyCorsair RMe (2023) 1200 W 80+ Gold Certified Fully Modular ATX Power Supply

Is this overkill? Yes. Do I care? No. The idea was to build a system that could handle gaming under two environments, but not necessarily at the same time. It might come as a surprise which games run better under Linux than Windows, and vice versa.

Part 2: Installing Linux

I am no stranger to installing Linux on bare metal and virtual machines. However, something that did cause me some trouble was trying to find a kernel version that could support my graphics cards. Initially, I wanted to go with Debian 12. I like the stability that Debian provides, and wanted a system that was rock solid. Unfortunately, after several attempts at installing Debian 12, I learned that it's kernel (6.1.x at the time of writing this) did not contain drivers for my AMD card. I attempted to upgrade to Debian unstable (Sid), but found that my PC got stuck in a reboot loop that dropped into the BIOS each time the computer turned on. Eventually, I settled on Fedora. I had a bit of experience using Fedora in college, so I felt comfortable-ish with doing more advanced system administration.

As an aside, I have a server that runs Debian 12. It's main purpose is to be a development environment and to host multiplayer game servers. I also have a Raspberry Pi that is running Raspbian (Debian), so the notion of having a homogenous Debian based home network was very attractive.

Once Fedora was installed, I had no issues with my AMD graphics card. It worked right out of the box with no additional tweaks.

Part 3: Configuring the kernel for PCI passthrough

This page is not meant to be a tutorial, but I'll mention some of the important parts to get this working.

First, you must add a few kernel command line arguments within your bootloader. I use GRUB. In my GRUB config (/etc/default/grub), I've added the following line:

GRUB_CMDLINE_LINUX_DEFAULT="rhgb quiet intel_iommu=on iommu=pt kvm.ignore_msrs=1 default_hugepagesz=1G hugepagesz=1G hugepages=32"

For my Intel processor, I set intel_iommu=on. I've read that iommu=ptis good for improving the guest VM's performance, though I don't really know what it does. Likewise, setting up hugepages is good for improving performance of the VM.

Part 4: Isolating the NVIDIA GPU

Now that the kernel has IOMMU turned on, we can begin to isolate the GPU. Refer to section 3 of the Arch Wiki (listed below) for the necessary steps according to your specific setup. In my case, I had to figure out which PCI devices belonged to the NVIDIA card and set up the correct modprobe configuration. These PCI devices should belong to the same IOMMU group. To find these groups, run the script provided in section 2.2 of the Arch Wiki. Once that was complete, everything just worked.

For example, below is my /etc/modprobe.d/vfio.conf file:

options vfio-pci ids=10de:2786,10de:22bc

Next, create the following Dracut configuration file: /etc/dracut.conf.d/10-vfio.conf. This includes vfio drivers within the initramfs:

force_drivers+=" vfio_pci vfio vfio_iommu_type1 "

After setting up these files, we must then regenerate the initramfs. See the Arch Wiki article on Dracut.

Part 5: Setting up Windows 11

I use Virt Manager (Virtual Machine Manager) to manage my QEMU/KVM virtual machines. The setup process is fairly simple. Create a new VM, allocate some memory, a virtual hard disk image, etc. Then, add the isolated GPU and audio hardware as new PCI devices. Install Windows 11 as usual, and away you go.

Hey! It is really important to realize something. Once your GPU is isolated to the VM, you need to connect a spare monitor to your graphics card. Do NOT use the VM's virtual display. The whole point is to use the physical GPU with the VM, and that includes any spare HDMI or DVI ports.

Once you're up and running, there are a bunch of tweaks you can make to tailor your system to your needs. I've done a few things, like enable hugepages and CPU core pinning, which have increased performance and stability immensely.

Sources

Last modified:2024/12/20 10:14:49
Previously modified:2024/04/04 10:22:21
Go back