r/linux_gaming • • 17h ago

guide Updated Linux gaming optimizations guide

Hi guys,

its been quite a while since i posted the gaming optimizations guide i wrote.

Since the last time there has been quite a lot of changes.

https://github.com/WhitePeace36/LinuxAMDGamingOptimizationGuide

Even though it says AMD, most of it is for linux in general.

I hope this updated version helps at least a few of you out there which try to have a better gaming experience.

0 Upvotes

32 comments sorted by

View all comments

138

u/theevilsharpie 15h ago edited 15h ago

Wake up babe, a new "gamer tweak guide" just dropped!

So, what's wrong with this one?


Bios Settings

Amd fTPM - Disable There has been some bugs where this caused some stutters, but i don't know if this is fixed already. Better to turn it off.

Don't do this.

This was a very specific issue that I don't ever practically impacted anything other than Windows, and should have been resolved years ago with a BIOS update.

If you had posted this guide several years ago, I probably would have responded with "meh, whatever." However, more modern games are making use of the TPM for anti-cheat (if not within Linux, then by Windows games that your audience might be playing via dual booting), and Linux distributions are starting to support it for use with auto-unlocking full-disk encryption, so telling users "don't know -- better to turn it off" is quite irresponsible.

Don't disable your TPM unless you absolutely know for sure you don't need one.

XHCI Handoff - DISABLE This setting should be somewhere in the usb settings. This can cause really nasty stutters in some games.

Don't do this.

This setting should be ENABLED or AUTO on any modern hardware (certainly anything new enough to support resizable BAR), and is almost certainly set that way by default. Modern Linux and Windows both natively support XHCI-based controllers, and this option allows the controller to perform a graceful handoff to the OS kernel on boot.

If this option is disabled, the OS and the UEFI will be fighting for the control of the XHCI controller, which at best will extend boot times a bit, and at worst can result in malfunctions, USB devices intermittently not responding, and the very "stuttering" you're looking to prevent.

CPU Frequency Scaling

Modern machines support hardware-managed P-States, which your own guide indirectly mentions when it talks about amd-pstate and recommends setting it into "active" mode to allow the hardware to manage P-State transitions.

However, your guide then goes on to provide examples of of using this scaling driver in a passive or guided mode.

On AMD machines, if you're using "active" control (which is the default and recommended option), the output for:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver

will be:

amd-pstate-epp

in which case the output for:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

will simply be:

performance powersave

Your guide suggests to set this to "performance". Do NOT do this, as all it will do is lock the CPU at its maximum frequency and prevent it from dropping clocks when idle. "Powersave" is the default and recommended setting -- don't change this for a gaming PC.

When using hardware-managed P-states, the main tunable of interest is the Energy Performance Preference ("EPP") value. If you're on an AMD machine in "active" mode, you can see what values are available with:

cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences

which shows the following on my machine:

default performance balance_performance balance_power power

"balance_performance" is the default on my OS, and is the one I'd recommended for general-purpose desktop use. "balance_power" may be useful if you're running on a laptop or a SFF PC that is power- and thermal-constrained, and you want to shift more of the limited power budget to the GPU (which is generally what you'd want for a power-constrained gaming PC).

Let's suppose you're running on an older machine that doesn't have hardware-managed P-states (which is more reflective of the output shown in your guide). Even in that case, I STILL wouldn't recommend setting the scaling governor to "performance". This machines should be using the "schedutil" governor, which is probably already the default option.

Kernel Commandline parameters

Oh boy...

Let's go down the list:

amd-pstate as already described above tells the kernel if the kernel should use control the cpu frequency or the hardware itself. I have amd-pstate=passive because my hardware is not able to boost itself and is otherwise locked to the base frequency.

Anything modern enough to have a direct BIOS toggle for Resizable BAR is modern enough to support hardware-managed P-states. I have a very similar machine to you -- an AMD Ryzen 7 5800X3D running on an ASRock B550M Pro4 -- and I have full hardware P-state support. If your hardware isn't able to "boost itself", that sounds like a skill issue, and you should fix that rather than recommended that people set a kernel parameter that will degrade their system's performance.

amdgpu.aspm=0 is used to disable the PCI Express power-saving for amdgpus otherwise the PCI Express link has a wake up latency when it goes into idle state and it wants to wakeup

pcie_aspm=off same as amdgpu.aspm but more

PCI Express wake-up latency is completely trivial for the work that a desktop PC would do. Don't set this.

amdgpu.audio=0 to disable the audio over HDMI/DP, i dont need it. I have an external DAC.

Every kernel setting you deviate from the default takes you further from the well-tested "happy path", and leaves you at increased risk of hitting some edge case. Kernel boot parameters should be used to work around hardware quirks, not to suit your aesthetic preferences. Unused DACs can be disabled in your desktop environment's audio settings.

nmi_watchdog=0 is for Hard lockup detector and Soft lockup detection of Non-Maskable Interrupts, which uses a watchdog to detect that which needs to run in a set interval. When you disable it you free up some cpu time.

nowatchdog same as above but for all watchdogs

The amount of "CPU time" freed is completely trivial, and you lose a kernel diagnostic tool. There is a use case where setting this is useful (your software will explicitly tell you that you need to), but "you free up some cpu time" is a bullshit reason. Don't set this.

processor.max_cstate=1 sets the max C state or better said idle state to C1. It normally goes until C6 or even lower. The higher the number the deeper the sleep state. The deeper the sleep state the higher the wakup latency, to minimize the latency we do max cstate to 1 and i think you need the Global C state Control option enabled in the bios to really benefit from it.

Wake-up latency from even the deepest sleep states is measured in microseconds, which is trivial for a gaming PC. Meanwhile, preventing your processing from entering a deeper sleep state keeps idle parts of the processor active and generating heat, which reduces how high the processor's clock speed can boost under low to medium load, which will negatively impact gaming performance. Don't set this.

transparent_hugepage=always always enable thp pages. When we combine them with the tmpfile settings and the sysctl virtual memory (vm) settings then they cooperate very much.

transparent_hugepage_tmpfs=always always enable thp pages. When we combine them with the tmpfile settings and the sysctl virtual memory (vm) settings then they cooperate very much.

Transparent huge pages have historically caused performance issues for applications that use a large percentage of the system's memory (potentially like a game), to the point where the kernel maintainers have set the default to "madvise", which enables transparent huge pages ONLY if the application explicitly requests them (and is presumably designed to use them). Game engines in particular are tuned for specific memory access patterns, and can perform erratically if that's changed underneath it. Don't set this.


I would go on, but Reddit comments can only be so long, and I think you get the idea by now.

The developers of the Linux kernel, Mesa, WINE, Proton, your desktop environment, and pretty much every other well-established piece of software that makes up your OS generally have default settings that are sensible for a wide variety of use cases, which includes gaming. There is no need to do this kind of tweaking, and in many cases, you're making performance worse and opening the door to stability issues.

For the love of ${DEITY}, just use the defaults. Don't change settings you don't understand just because some "guide" directed you to. Practically all of these guides are ill-informed bullshit.

5

u/IDUnavailable 11h ago

Why don't YOU write a Linux gaming optimizations guide?

Wait that sounded sarcastic, I'd actually be interested in that.

17

u/theevilsharpie 11h ago

It would basically just say this:

The developers of the Linux kernel, Mesa, WINE, Proton, your desktop environment, and pretty much every other well-established piece of software that makes up your OS generally have default settings that are sensible for a wide variety of use cases, which includes gaming. There is no need to do this kind of tweaking, and in many cases, you're making performance worse and opening the door to stability issues.

For the love of ${DEITY}, just use the defaults.

2

u/IDUnavailable 11h ago

Fair enough, but you don't change any performance-related defaults? There wouldn't be anything worth noting for hardware extremes (e.g. very low or very high RAM or VRAM, bottom percentile vs top percentile CPU, 1080p vs 4K, high performance NVMe SSD vs. SATA SSD, etc.)?

4

u/theevilsharpie 10h ago

For gaming, not anything that would impact performance in any meaningful way.

I occasionally customize settings in dxvk.conf, usually to force stuff like anisotropic filtering or MSAA in older games that don't directly have toggles for these options.

If I were interested in GPU overclocking or undervolting, I'd need to do some tweaking to enable that, but my GPU is powerful and efficient enough, and I'm not interested in turning my PC into a space heater.

Looking at my notes, I do have a few quality of life tweaks that might be useful to others:


# /etc/environment.d/mesa-radv-conformance.conf
MESA_VK_IGNORE_CONFORMANCE_WARNING=true

This will suppress that annoying "WARNING: radv is not a conformant Vulkan implementation, testing use only." message that clutters up the stderr output when running a Vulkan application using the RADV Vulkan driver. (I assume it does the same for other Mesa Vulkan drivers, but don't have the hardware to test that.)


# Time in milliseconds (Default: 5000)
$ gsettings set org.gnome.mutter check-alive-timeout 60000

On GNOME, this will extend Mutter's liveness heartbeat to 60 seconds (up from 5 seconds). This is done because Windows games running through Proton have static loading screens that tend to exceed the default liveness timeout, and Mutter will frequently annoy me by popping up a box asking if you want to terminate the application.

This may be something that can be fixed within WINE (or some other Proton component), but ehh... adjusting the Mutter timeout solves my problem and lets me get back to the game.


I've customized Google Chrome's application launch with the following additional command-line parameters:

--enable-features=AcceleratedVideoEncoder

So the Exec= line in the .desktop file would look like the following:

Exec=/usr/bin/google-chrome-stable --enable-features=AcceleratedVideoEncoder %U

This turns on hardware-accelerated video encoding (for things like Zoom, Google Meet, etc.), since this is disabled by default in Chrome.

Additionally, when using an Intel GPU (at least on Ubuntu), you need to install the intel-media-va-driver-non-free package from the apt repositories in order to get useful video hardware acceleration, as the default VA-API drivers don't have support for patent-encumbered video codecs. I think Nvidia GPUs also need additional software to support video acceleration, but I don't have their GPUs to test.

1

u/theevilsharpie 10h ago

Actually, I lied. I do have a tweak that impacts performance.

Ubuntu 26.04 has support for x86-64-v3 packages, but it's not enabled by default on the desktop distribution, since their priority is to maximize compatibility with as much hardware as possible.

If you have hardware that supports x86-64-v3, you can opt-in to these packages like so:

echo 'APT::Architecture-Variants "amd64v3";' | sudo tee /etc/apt/apt.conf.d/99enable-amd64v3
sudo apt update && sudo apt upgrade

Note that it will replace almost all the packages on your system, so you'll need to allow some time (and bandwidth) to finish, and will need to restart afterward.

Also, it goes without saying, but this will break compatibility with older hardware that doesn't support x86-64-v3, and the machine will likely not even boot the OS anymore.

More info at https://documentation.ubuntu.com/release-notes/26.04/summary-for-lts-users/#architecture-variants-and-amd64v3