mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
120 lines
3.9 KiB
Plaintext
120 lines
3.9 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * virt/vm_networking/virt-connecting-vm-to-sriov.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="virt-configuring-vm-dpdk_{context}"]
|
|
= Configuring a virtual machine for DPDK workloads
|
|
|
|
[role="_abstract"]
|
|
You can run Data Packet Development Kit (DPDK) workloads on virtual machines (VMs) to achieve lower latency and higher throughput for faster packet processing in the user space. DPDK uses the SR-IOV network for hardware-based I/O sharing.
|
|
|
|
.Prerequisites
|
|
* Your cluster is configured to run DPDK workloads.
|
|
* You have created and configured the project in which the VM will run.
|
|
* You have installed the {oc-first}.
|
|
|
|
.Procedure
|
|
. Edit the `VirtualMachine` manifest to include information about the SR-IOV network interface, CPU topology, CRI-O annotations, and huge pages.
|
|
+
|
|
Example `VirtualMachine` manifest:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: kubevirt.io/v1
|
|
kind: VirtualMachine
|
|
metadata:
|
|
name: rhel-dpdk-vm
|
|
spec:
|
|
runStrategy: Always
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
cpu-load-balancing.crio.io: disable <1>
|
|
cpu-quota.crio.io: disable <2>
|
|
irq-load-balancing.crio.io: disable <3>
|
|
spec:
|
|
domain:
|
|
cpu:
|
|
sockets: 1 <4>
|
|
cores: 5 <5>
|
|
threads: 2
|
|
dedicatedCpuPlacement: true
|
|
isolateEmulatorThread: true
|
|
interfaces:
|
|
- masquerade: {}
|
|
name: default
|
|
- model: virtio
|
|
name: nic-east
|
|
pciAddress: '0000:07:00.0'
|
|
sriov: {}
|
|
networkInterfaceMultiqueue: true
|
|
rng: {}
|
|
memory:
|
|
hugepages:
|
|
pageSize: 1Gi <6>
|
|
guest: 8Gi
|
|
networks:
|
|
- name: default
|
|
pod: {}
|
|
- multus:
|
|
networkName: dpdk-net <7>
|
|
name: nic-east
|
|
# ...
|
|
----
|
|
<1> This annotation specifies that load balancing is disabled for CPUs that are used by the container.
|
|
<2> This annotation specifies that the CPU quota is disabled for CPUs that are used by the container.
|
|
<3> This annotation specifies that Interrupt Request (IRQ) load balancing is disabled for CPUs that are used by the container.
|
|
<4> The number of sockets inside the VM. This field must be set to `1` for the CPUs to be scheduled from the same Non-Uniform Memory Access (NUMA) node.
|
|
<5> The number of cores inside the VM. This must be a value greater than or equal to `1`. In this example, the VM is scheduled with 5 hyper-threads or 10 CPUs.
|
|
<6> The size of the huge pages. The possible values for x86-64 architecture are 1Gi and 2Mi. In this example, the request is for 8 huge pages of size 1Gi.
|
|
<7> The name of the SR-IOV `NetworkAttachmentDefinition` object.
|
|
|
|
. Save and exit the editor.
|
|
. Apply the `VirtualMachine` manifest:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <file_name>.yaml
|
|
----
|
|
|
|
. Configure the guest operating system. The following example shows the configuration steps for {op-system-base} 9 operating system:
|
|
.. Configure huge pages by using the GRUB bootloader command-line interface. In the following example, 8 1G huge pages are specified.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ grubby --update-kernel=ALL --args="default_hugepagesz=1GB hugepagesz=1G hugepages=8"
|
|
----
|
|
|
|
.. To achieve low-latency tuning by using the `cpu-partitioning` profile in the TuneD application, run the following commands:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ dnf install -y tuned-profiles-cpu-partitioning
|
|
----
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ echo isolated_cores=2-9 > /etc/tuned/cpu-partitioning-variables.conf
|
|
----
|
|
The first two CPUs (0 and 1) are set aside for house keeping tasks and the rest are isolated for the DPDK application.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ tuned-adm profile cpu-partitioning
|
|
----
|
|
|
|
.. Override the SR-IOV NIC driver by using the `driverctl` device driver control utility:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ dnf install -y driverctl
|
|
----
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ driverctl set-override 0000:07:00.0 vfio-pci
|
|
----
|
|
|
|
. Restart the VM to apply the changes.
|