SR-IOV configuration depends on the kernel version:
- Optimal configuration may be achieved with a new kernel in which the
sriov_drivers_autoprobe sysfsentry exists in
- Otherwise, the minimal requirement may be met if the
sriov_totalvfs sysfsentry exists in
After configuration is finished, no disk is expected to be exposed in the hypervisor. The disk only appears in the VM after the PCIe VF is assigned to it using the virtualization manager. If users want to use the device from the hypervisor, they must bind the PCIe VF manually.
If hot-plug is needed, the max number of VFs is limited to 250. If hot-plug is not needed then set
Hot-plug PFs do not support SR-IOV.
It is recommended to add
pci=assign-busses to the boot command line when creating more than 127 VFs.
Without this option, the following errors may appear from host and the virtio driver will not probe these devices.
Zero Copy (SNAP-direct)
Zero-copy is supported on SPDK 21.07 and higher.
SNAP-direct allows SNAP applications to transfer data directly from the host memory to remote storage without using any staging buffer inside the DPU.
SNAP enables the feature according to the SPDK BDEV configuration only when working against an SPDK NVMe-oF RDMA block device.
To enable zero copy, set the environment variable (as it is enabled by default):
For more info refer to the section SNAP Environment Variables.
NVMe/TCP XLIO Zero Copy
NVMe/TCP Zero Copy is implemented as a custom NVDA_TCP transport in SPDK NVMe initiator and it is based on a new XLIO socket layer implementation.
The implementation is different for Tx and Rx:
- The NVMe/TCP Tx Zero Copy is similar between RDMA and TCP in that the data is sent from the host memory directly to the wire without an intermediate copy to Arm memory
- The NVMe/TCP Rx Zero Copy allows achieving partial zero copy on the Rx flow by eliminating copy from socket buffers (XLIO) to application buffers (SNAP). But data still must be DMA'ed from Arm to host memory.
To enable NVMe/TCP Zero Copy, use
SPDK v22.05.nvda --with-xlio (
v22.05.nvda or higher).
For more information about XLIO including limitations and bug fixes, refer to the NVIDIA Accelerated IO (XLIO) Documentation.
To enable the SNAP TCP XLIO Zero Copy, set the environment variables and resources in the YAML file:
NVMe/TCP XLIO requires DPU OS hugepage size of 4G (i.e., 2G more hugepages than non-XLIO). For information on configuring the hugepages, refer to sections "Step 1: Allocate Hugepages" and "Adjusting YAML Configuration".
At high scale, it is required to use the global variable
XLIO_RX_BUFS=4096 even though it leads to high memory consumption. Using
XLIO_RX_BUFS=1024 requires lower memory consumption but limits the ability to scale the workload.
For more info refer to the section SNAP Environment Variables.
Expose an NVMe-oF subsystem with one namespace by using a TCP transport type on the remote SPDK target.
For more information on XLIO, please refer to XLIO documentation.
VirtIO-blk Live Migration
Live migration is a standard process supported by QEMU which allows system administrators to pass devices between virtual machines in a live running system. For more information, refer to QEMU VFIO Device Migration documentation.
Live migration is supported for SNAP virtio-blk devices. It can be activated using a driver with proper support (e.g., NVIDIA's proprietary vDPA-based Live Migration Solution).
SNAP Container Live Upgrade
Live upgrade allows upgrading the SNAP image a container is using without SNAP container downtime.
Live Upgrade Prerequisites
To enable live upgrade, perform the following modifications:
- Allocate resources:
- Allocate additional 2Gi hugepages.
Make sure the requested amount of CPU cores is available.
The default YAML configuration sets the container to request a CPU core range of 8-16. This means that the container is not deployed if there are fewer than 8 available cores, and if there are 16 free cores, the container utilizes all 16.
For instance, if a container is currently using all 16 cores and, during a live upgrade, an additional SNAP container is deployed. In this case, each container uses 8 cores during the upgrade process. Once the source container is terminated, the destination container starts utilizing all 16 cores.
For 8-core DPUs, the
.yamlmust be edited to the range of 4-8 CPU cores.
- Change the name of the
doca_snap.yamlfile that describes the destination container (e.g.,
doca_snap_new.yaml) so as to not overwrite the running container
- Change the name of the new
.yamlpod in line 16 (e.g.,
Live Upgrade Flow
The way to live upgrade the SNAP image is to move the SNAP controllers and SPDK block devices between different containers while minimizing the duration of the host VMs impact.
- Source container – the running container before live upgrade
- Destination container – the running container after live upgrade
SNAP Container Live Upgrade Procedure
- Follow the steps in section "Live Upgrade Prerequisites" and deploy the destination SNAP container using the modified
Query the source and destination containers:
Query the active SPDK bdevs and SNAP objects in the source container using SPDK and SNAP RPCs. To post RPCs use the
- Run the live upgrade algorithm to move all active objects from the source container to the destination container.
Delete the source container.
To automate the SNAP configuration (e.g., following failure or reboot) as explained in section "Automate SNAP Configuration (Optional)",
snap_rpc_init.confmust not include any configs as part of the live upgrade. Then, once the transition to the new container is done,
snap_rpc_init.confcan be modified with the desired configuration.
SNAP Container Live Upgrade Algorithm
The goal is to shorten the downtime between each emulation function.
Downtime is the period when the controller is deleted in the source container until it is recreated in the destination container. The fact that each function can be linked to only one controller at a time across all containers on the DPU, mandates that the deletion and creation operations are performed serially.
The rest of the objects (i.e., subsystems, namespaces, and bdevs) do not have this limitation. Therefore, several instances can be opened for each object at the same time.
A hot-plugged PCIe function remains persistent through different SNAP containers, until it is either explicitly unplugged or the system goes through a cold reboot. Therefore, Live Upgrade for Hotplug emulation functions is the same as physical emulation functions.
If shared SNAP objects (subsystems and namespaces) and BDEVs are used:
- The simple approach is to create the objects in the destination container before running the algorithm, and to delete them in source container after running the algorithm
- A more advanced solution is to create the objects in the destination container at first appearance and to delete them when they are no longer used in the source container
Live Upgrade Algorithm for Virtio-blk Emulation Functions
Iterate over the virtio-blk physical emulation functions (PF), for each PF:
- If the PF's controller is attached to a bdev, create in advance the same bdev in the destination container. This does not impact the source PF but shortens down time for the specific function.
- Destroy the PF's virtio-blk controller in the source container.
- Create the same virtio-blk controller in the destination container. Once this step is complete, the down time of the function ends.
- Delete the bdev in the source container if one exists.
- For each of the virtio-blk virtual emulation functions of the PFs, perform steps 1-4 but for VFs instead of PFs.
Live Upgrade Algorithm for NVMe Emulation Functions
Iterate over the NVMe physical emulation functions (PF), for each PF:
- Create in advance the subsystem, bdevs and namespaces (with the same
uuidin the source container namespace) to be used by the PF's controller in destination container. This does not impact the source container or the source PF but shortens the down time for the specific function.
- Suspend the PF's NVMe controller in the source container then destroy it.
- Create the PF's NVMe controller in the destination container with the suspended flag and attach it to the namespaces and resume it. Once this step is complete, the down time of the function ends.
- Clean up the unused objects in source container.
- For each of the NVMe virtual emulation functions of the PFs, perform steps 1-4 but for VFs instead of PFs.
SR-IOV Dynamic MSIX Management
Message Signaled Interrupts eXtended (MSIX) is an interrupt mechanism that allows devices to use multiple interrupt vectors, providing more efficient interrupt handling than traditional interrupt mechanisms such as shared interrupts. In Linux, MSIX is supported in the kernel and is commonly used for high-performance devices such as network adapters, storage controllers, and graphics cards. MSIX provides benefits such as reduced CPU utilization, improved device performance, and better scalability, making it a popular choice for modern hardware.
However, proper configuration and management of MSIX interrupts can be challenging and requires careful tuning to achieve optimal performance, especially in a multi-function environment as SR-IOV.
By default, BlueField distributes MSIX vectors evenly between all virtual PCI functions (VFs). This approach is not optimal as users may choose to attach VFs to different VMs, each with a different number of resources. Dynamic MSIX management allows the user to manually control of the number of MSIX vectors provided per each VF independently.
Configuration and behavior are similar for all emulation types, and specifically NVMe and virtio-blk.
Dynamic MSIX management is built from several configuration steps:
- PF controller must be opened with dynamic MSIX management enabled.
- At this point, and in any other time in the future when no VF controllers are opened (
sriov_numvfs=0), all PF-related MSIX vectors can be reclaimed from the VFs to the PF's free MSIX pool.
- User must take some of the MSIX from the free pool and give them to a certain VF during VF controller creation.
- When destroying a VF controller, the user may choose to release its MSIX back to the pool.
Once configured, the MSIX link to the VFs remains persistent and may change only in the following scenarios:
- User explicitly requests to return VF MSIXs back to the pool during controller destruction.
- PF explicitly reclaims all VF MSIXs back to the pool.
- Arm reboot (FE reset/cold boot) has occurred.
To emphasize, the following scenarios do not change MSIX configuration:
- Application restart/crash.
- Closing and reopening PF/VFs without dynamic MSIX support.
The following is an NVMe example of dynamic MSIX configuration steps (similar configuration also applies for virtio-blk):
Open controller on PF with dynamic MSIX capability:
Reclaim all MSIX from VFs to PF's free MSIX pool:
Query controllers list to get information about how many MSIX are returned to the pool:
Set SR-IOV on the host driver:
Distribute MSIX between VFs during their creation process:
Upon VF teardown, release MSIX back to the free pool:
It is highly advised to open all VF controllers in SNAP in advance before binding VFs to the host/guest driver. That way, for example in case of a configuration mistake which does not leave enough MSIX for all VFs, the configuration remains reversible as MSIX is still modifiable. Otherwise, the driver may try to use the already-configured VFs before all VF configuration has finished but will not be able to use all of them (due to lack of MSIX). The latter scenario may result in host deadlock which, at worst, can be recovered only with cold boot.
There are several ways to configure dynamic MSIX safely (without VF binding):
Disable kernel driver automatic VF binding to kernel driver:
After finishing MSIX configuration for all VFs, they can then be bound to VMs, or even back to the hypervisor:
- Use VFIO driver (instead of kernel driver) for SR-IOV configuration.
Host OS Configuration
With Linux environment on host OS, additional kernel boot parameters may be required to support SNAP related features:
- To use SR-IOV:
- For Intel, "
intel_iommu=on iommu=on" must be added
- For AMD, "
amd_iommu=on iommu=on" must be added
- For Intel, "
- To use PCIe hotplug,
pci=reallocmust be added
modprobe.blacklist=virtio_blkfor non-built in virtio-blk driver
To view boot parameter values, use the command
It is recommended to use the following with virtio-blk:
To enable VFs (virtio_blk/NVMe):