1.. SPDX-License-Identifier: BSD-3-Clause 2 Copyright(c) 2010-2014 Intel Corporation. 3 4.. _Enabling_Additional_Functionality: 5 6Enabling Additional Functionality 7================================= 8 9.. _Running_Without_Root_Privileges: 10 11Running DPDK Applications Without Root Privileges 12------------------------------------------------- 13 14In order to run DPDK as non-root, the following Linux filesystem objects' 15permissions should be adjusted to ensure that the Linux account being used to 16run the DPDK application has access to them: 17 18* All directories which serve as hugepage mount points, for example, ``/dev/hugepages`` 19 20* If the HPET is to be used, ``/dev/hpet`` 21 22When running as non-root user, there may be some additional resource limits 23that are imposed by the system. Specifically, the following resource limits may 24need to be adjusted in order to ensure normal DPDK operation: 25 26* RLIMIT_LOCKS (number of file locks that can be held by a process) 27 28* RLIMIT_NOFILE (number of open file descriptors that can be held open by a process) 29 30* RLIMIT_MEMLOCK (amount of pinned pages the process is allowed to have) 31 32The above limits can usually be adjusted by editing 33``/etc/security/limits.conf`` file, and rebooting. 34 35Additionally, depending on which kernel driver is in use, the relevant 36resources also should be accessible by the user running the DPDK application. 37 38For ``vfio-pci`` kernel driver, the following Linux file system objects' 39permissions should be adjusted: 40 41* The VFIO device file, ``/dev/vfio/vfio`` 42 43* The directories under ``/dev/vfio`` that correspond to IOMMU group numbers of 44 devices intended to be used by DPDK, for example, ``/dev/vfio/50`` 45 46.. note:: 47 48 The instructions below will allow running DPDK with ``igb_uio`` or 49 ``uio_pci_generic`` drivers as non-root with older Linux kernel versions. 50 However, since version 4.0, the kernel does not allow unprivileged processes 51 to read the physical address information from the pagemaps file, making it 52 impossible for those processes to be used by non-privileged users. In such 53 cases, using the VFIO driver is recommended. 54 55For ``igb_uio`` or ``uio_pci_generic`` kernel drivers, the following Linux file 56system objects' permissions should be adjusted: 57 58* The userspace-io device files in ``/dev``, for example, ``/dev/uio0``, ``/dev/uio1``, and so on 59 60* The userspace-io sysfs config and resource files, for example for ``uio0``:: 61 62 /sys/class/uio/uio0/device/config 63 /sys/class/uio/uio0/device/resource* 64 65 66Power Management and Power Saving Functionality 67----------------------------------------------- 68 69Enhanced Intel SpeedStep® Technology must be enabled in the platform BIOS if the power management feature of DPDK is to be used. 70Otherwise, the sys file folder ``/sys/devices/system/cpu/cpu0/cpufreq`` will not exist, and the CPU frequency- based power management cannot be used. 71Consult the relevant BIOS documentation to determine how these settings can be accessed. 72 73For example, on some Intel reference platform BIOS variants, the path to Enhanced Intel SpeedStep® Technology is:: 74 75 Advanced 76 -> Processor Configuration 77 -> Enhanced Intel SpeedStep® Tech 78 79In addition, C3 and C6 should be enabled as well for power management. The path of C3 and C6 on the same platform BIOS is:: 80 81 Advanced 82 -> Processor Configuration 83 -> Processor C3 Advanced 84 -> Processor Configuration 85 -> Processor C6 86 87Using Linux Core Isolation to Reduce Context Switches 88----------------------------------------------------- 89 90While the threads used by a DPDK application are pinned to logical cores on the system, 91it is possible for the Linux scheduler to run other tasks on those cores also. 92To help prevent additional workloads from running on those cores, 93it is possible to use the ``isolcpus`` Linux kernel parameter to isolate them from the general Linux scheduler. 94 95For example, if DPDK applications are to run on logical cores 2, 4 and 6, 96the following should be added to the kernel parameter list: 97 98.. code-block:: console 99 100 isolcpus=2,4,6 101 102.. _High_Precision_Event_Timer: 103 104High Precision Event Timer (HPET) Functionality 105----------------------------------------------- 106 107DPDK can support the system HPET as a timer source rather than the system default timers, 108such as the core Time-Stamp Counter (TSC) on x86 systems. 109To enable HPET support in DPDK: 110 111#. Ensure that HPET is enabled in BIOS settings. 112#. Enable ``HPET_MMAP`` support in kernel configuration. 113 Note that this my involve doing a kernel rebuild, 114 as many common linux distributions do *not* have this setting 115 enabled by default in their kernel builds. 116#. Enable DPDK support for HPET by using the build-time meson option ``use_hpet``, 117 for example, ``meson configure -Duse_hpet=true`` 118 119For an application to use the ``rte_get_hpet_cycles()`` and ``rte_get_hpet_hz()`` API calls, 120and optionally to make the HPET the default time source for the rte_timer library, 121the ``rte_eal_hpet_init()`` API call should be called at application initialization. 122This API call will ensure that the HPET is accessible, 123returning an error to the application if it is not. 124 125For applications that require timing APIs, but not the HPET timer specifically, 126it is recommended that the ``rte_get_timer_cycles()`` and ``rte_get_timer_hz()`` 127API calls be used instead of the HPET-specific APIs. 128These generic APIs can work with either TSC or HPET time sources, 129depending on what is requested by an application call to ``rte_eal_hpet_init()``, 130if any, and on what is available on the system at runtime. 131 132Using Linux IOMMU Pass-Through to Run DPDK with Intel® VT-d 133----------------------------------------------------------- 134 135To enable Intel® VT-d in a Linux kernel, a number of kernel configuration options must be set. These include: 136 137* ``IOMMU_SUPPORT`` 138 139* ``IOMMU_API`` 140 141* ``INTEL_IOMMU`` 142 143In addition, to run the DPDK with Intel® VT-d, the ``iommu=pt`` kernel parameter must be used when using ``igb_uio`` driver. 144This results in pass-through of the DMAR (DMA Remapping) lookup in the host. 145Also, if ``INTEL_IOMMU_DEFAULT_ON`` is not set in the kernel, the ``intel_iommu=on`` kernel parameter must be used too. 146This ensures that the Intel IOMMU is being initialized as expected. 147 148Please note that while using ``iommu=pt`` is compulsory for ``igb_uio`` driver, 149the ``vfio-pci`` driver can actually work with both ``iommu=pt`` and ``iommu=on``. 150