Masking interrupt, shielding CPUs, and other techniques I have found useful for reducing latency and improving performance

Introduction

As a quick introduction, vfio is the name of the technology built in the linux kernel which allows to map io devices to kvm guests. The name is also slightly abused to refer to the use of said feature, typically to map discrete GPUs to Windows/OSX machines on linux hosts, which allows the user to run GPU-bound tasks in said OSes without the need for a dual-boot setup.

In short, this is what some crazy gamers like me do to play stuff without running Windows baremetal or go through the issues Proton still has.

This, however, is not free of challenges. Virtualization is a complex topic, specially when running latency-sensitive workloads such as gaming, when more than 16ms of time between frames is usually considered unacceptable.

In this article I will explore some of the techniques I have used and tested, which are less known than the usual CPU-pinning, Hyper-V Enlightments, and in general everything covered on the Archlinux wiki page about VFIO.

I repeat: This article considers the topics covered in the wiki page linked above as the bare minimum. If you intend to use this as a reference for tweaking your own setup, make sure you understand all the strategies discussed there.

And now, let’s jump to the action