vmm: add NVIDIA GPUDirect P2P support. #6235
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On platforms where PCIe P2P is supported, inject a PCI capability into NVIDIA GPU to indicate support.
A previous PR added support for PCIe P2P between VFIO devices. The NVIDIA driver does not utilize PCIe P2P unless it detects hardware support. The PCIe specification doesn't require platforms to support PCIe P2P traffic between root ports (although many systems do). Within a virtual machine, information about the host PCIe bridge is lost, so NVIDIA recommends the use of an injected PCI capability to signal support for PCIe P2P between GPUs.
This PR adds a new argument
x_nv_gpudirect_clique
to VFIO devices--device path=<PCI_DEVICE_PATH>,x_nv_gpudirect_clique=<CLIQUE_ID>
that injects a PCI capability indicating the "P2P clique" that the GPU belongs to. This option is only valid for modern datacenter NVIDIA GPUs (NVIDIA Turing, Ampere, Hopper, and Lovelace). The NVIDIA provided specification can be found here.After enabling this feature, we benchmarked a decrease in GPU P2P latency from
12 us
to1.4 us
compared to the fallback shared memory communication mechanism.The
nvidia-smi
utility can be used to confirm that the P2P support. For example, the following cloud-hypervisor guest has 4 NVIDIA L40S GPUS.