GPU Passthrough
Overview
GPU passthrough assigns an entire NVIDIA GPU to a single KVM virtual server. The guest operating system (OS) gets direct, exclusive access to the physical GPU. It can use all of the GPU’s memory and compute power, and SolusVM does not partition the GPU.
You configure GPUs on a compute resource for passthrough, and then create plans that offer a GPU model. When a customer creates a server from a GPU plan, SolusVM finds a matching compute resource with a free GPU of that model. SolusVM then attaches the GPU to the server automatically.
To share a GPU between several servers instead, see Virtual GPUs (vGPUs).
Important:
GPU passthrough has the following limitations:
- Only KVM servers support GPU passthrough.
- A server can only have one GPU, and each GPU can only belong to one server.
- Disaster Recovery does not cover servers with a passthrough GPU.
- You cannot migrate a server with a passthrough GPU. To move such a server, detach the GPU, migrate the server, and then attach a free GPU on the destination compute resource. For more information, see Migration of Servers Between Compute Resources.
- You can only resize a server to plans that offer the same GPU model.
- You can only restore a backup to a compute resource that has a free GPU of the same model.
Prerequisites
Before you configure GPU passthrough, ensure that you meet the following requirements:
- Your SolusVM version is 2.0.0-44576 or newer.
- The server uses the i440fx machine type. SolusVM rejects other machine types, such as q35.
- You have an NVIDIA GPU on each compute resource that will host passthrough servers, and you have installed the NVIDIA CUDA or GRID drivers on it. For steps, see Preparing the compute resource.
- You have enabled IOMMU in the BIOS or UEFI settings of the compute resource and in the kernel.
- The
vfio-pcikernel module is available on the compute resource. SolusVM automatically configures the PCI memory space that the GPU needs. - The GPU has its own IOMMU group. SolusVM does not support GPUs that share their slot with other functions, such as HDMI audio or USB-C controllers.
- The compute resource does not load the
nvidia_drmmodule with amodesetvalue of1. - No processes on the compute resource use the GPU.
Note:
SolusVM checks these requirements but does not change BIOS or kernel settings. The Passthrough column on the compute resource’s GPUs tab shows Compatible for a GPU that SolusVM can pass through and No for a GPU that it cannot. Hover over No to see the reason.
NVIDIA driver options
GPU passthrough relies on the nvidia-smi tool on the compute resource. It works with either NVIDIA host driver:
- CUDA (data center) drivers — You can only use GPUs for passthrough.
- GRID (vGPU) drivers — You can use each GPU for passthrough or for vGPU. vGPU also requires a GPU that supports SR-IOV-based vGPU partitioning.
Each GPU works in one mode at a time. A compute resource with several GPUs can have some GPUs in passthrough mode and others in vGPU mode.
Preparing the compute resource
Note:
The following steps assume that the compute resource runs Ubuntu® 24.04.
Install NVIDIA drivers
If you want to use GPUs for both passthrough and vGPU, install the NVIDIA GRID drivers and enable IOMMU. Otherwise, install the NVIDIA CUDA drivers.
To install the NVIDIA CUDA drivers:
Run the following command to install the necessary OS updates:
apt-get update && apt-get upgrade && apt-get dist-upgradeReboot the compute resource.
Run the following command to download the necessary
linux-headerspackages:apt-get install linux-headers-$(uname -r)Download the NVIDIA data center (CUDA) driver for your GPU model from the NVIDIA website and install it.
Reboot the compute resource.
Run the following command to ensure that your system can detect the NVIDIA driver:
nvidia-smi
Enable IOMMU
To enable IOMMU:
Enable IOMMU (Intel® VT-d or AMD-Vi) in the BIOS or UEFI settings of the compute resource.
Open the
/etc/default/grubfile and add the following parameters to theGRUB_CMDLINE_LINUX_DEFAULTvariable:- On Intel CPUs, add
intel_iommu=on iommu=pt nvidia-drm.modeset=0. - On AMD CPUs, add
amd_iommu=on iommu=pt nvidia-drm.modeset=0.
- On Intel CPUs, add
Run the following command to apply the changes:
update-grubReboot the compute resource.
Verify the configuration
To check the passthrough requirements:
Run the following command to check the IOMMU groups:
ls /sys/kernel/iommu_groupsThe output must not be empty.
Run the following command to ensure that the
vfio-pcimodule is available:modinfo vfio-pciRun the following command to ensure that the
nvidia_drmmodule does not hold the GPU:cat /sys/module/nvidia_drm/parameters/modesetThe output must be
N. If the file does not exist, the compute resource does not load thenvidia_drmmodule, which also works.Run the following command to find the PCI address of the GPU:
lspci -D | grep -i nvidiaRun the following command to list the devices in the IOMMU group of the GPU:
ls /sys/bus/pci/devices/0000:01:00.0/iommu_group/devicesReplace
0000:01:00.0with the PCI address of your GPU. The output must only contain the GPU itself, plus PCI bridges on some systems.
Configuring GPUs for passthrough
After you prepare the compute resource, set each GPU that you want to offer to passthrough mode.
To configure a GPU for passthrough:
- Go to Compute Resources and click the compute resource’s name.
- Go to the GPUs tab.
- Click Refresh to detect the GPUs on the compute resource.
- Click the
icon next to a GPU. - Select Passthrough in Allocation mode and click Apply.
SolusVM moves the GPU from the NVIDIA driver to the vfio-pci driver. The setting persists across compute resource reboots.
Note:
You cannot change the allocation mode of a configured GPU directly. To use the GPU in a different mode, click the
icon next to the GPU, and then click Un-configure. You cannot un-configure a GPU while a server uses it. This applies to running and stopped servers.
Creating plans with GPU passthrough
To offer passthrough GPUs to customers, create a plan that includes a GPU model. SolusVM only places servers that use this plan on compute resources that have a free GPU of that model.
To create a plan with GPU passthrough:
- Go to Compute Resources > Plans.
- Create or edit a KVM plan.
- Select Passthrough in Offer GPU.
- Select the model of GPU to offer in GPU model.
- Click Save.
To allow customers to select a GPU when ordering through WHMCS, see GPU.
Attaching or detaching a GPU
After customers create servers from GPU plans, you can attach or detach a passthrough GPU on a server. Unlike vGPU, you do not need to shut down the server first. SolusVM stops the server, applies the change, and starts the server again if it was running. For the vGPU steps, see Attaching or Detaching a vGPU.
To attach a passthrough GPU to an existing server:
- Go to Virtual Servers and click the server’s name.
- Go to the GPU tab.
- Click Attach GPU.
- Select Passthrough in Connection type.
- Select a free GPU and click Attach.
To detach the GPU, click Detach on the same tab.
Guest OS requirements
Install the standard NVIDIA driver for the GPU model inside the guest OS. Unlike vGPU, passthrough does not require an NVIDIA vGPU license. The guest driver does not have to match the driver version on the compute resource.
Troubleshooting
The following errors can occur when you configure or attach a passthrough GPU:
| Error | Solution |
|---|---|
GPU ... is in use by ...; stop these processes and retry | Stop the listed processes on the compute resource and try again. |
nvidia_drm (modeset=1) holds GPU ... | Unload the nvidia_drm module with the modprobe -r nvidia_drm command, or boot with the nvidia-drm.modeset=0 parameter, and then try again. |
... GPU ... is still in use; see the agent log in /var/log/solus on the compute resource | Something on the compute resource still holds the GPU, and the dmesg output shows NVRM: ... non-zero usage count. Stop what uses the GPU and try again. The agent log in the /var/log/solus directory has the steps to restore the GPU if it has no driver. |
Another GPU operation is in progress ... | Wait for the current operation to finish and try again. |
machine type "..." is not supported | The server uses a machine type other than i440fx. GPU passthrough only supports the i440fx machine type. |