1 .. SPDX-License-Identifier: BSD-3-Clause
2 Copyright(c) 2010-2014 Intel Corporation.
4 .. _Enabling_Additional_Functionality:
6 Enabling Additional Functionality
7 =================================
9 .. _Running_Without_Root_Privileges:
11 Running DPDK Applications Without Root Privileges
12 -------------------------------------------------
14 In order to run DPDK as non-root, the following Linux filesystem objects'
15 permissions should be adjusted to ensure that the Linux account being used to
16 run the DPDK application has access to them:
18 * All directories which serve as hugepage mount points, for example, ``/dev/hugepages``
20 * If the HPET is to be used, ``/dev/hpet``
22 When running as non-root user, there may be some additional resource limits
23 that are imposed by the system. Specifically, the following resource limits may
24 need to be adjusted in order to ensure normal DPDK operation:
26 * RLIMIT_LOCKS (number of file locks that can be held by a process)
28 * RLIMIT_NOFILE (number of open file descriptors that can be held open by a process)
30 * RLIMIT_MEMLOCK (amount of pinned pages the process is allowed to have)
32 The above limits can usually be adjusted by editing
33 ``/etc/security/limits.conf`` file, and rebooting.
35 Additionally, depending on which kernel driver is in use, the relevant
36 resources also should be accessible by the user running the DPDK application.
38 For ``vfio-pci`` kernel driver, the following Linux file system objects'
39 permissions should be adjusted:
41 * The VFIO device file, ``/dev/vfio/vfio``
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``
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.
55 For ``igb_uio`` or ``uio_pci_generic`` kernel drivers, the following Linux file
56 system objects' permissions should be adjusted:
58 * The userspace-io device files in ``/dev``, for example, ``/dev/uio0``, ``/dev/uio1``, and so on
60 * The userspace-io sysfs config and resource files, for example for ``uio0``::
62 /sys/class/uio/uio0/device/config
63 /sys/class/uio/uio0/device/resource*
66 Power Management and Power Saving Functionality
67 -----------------------------------------------
69 Enhanced Intel SpeedStepĀ® Technology must be enabled in the platform BIOS if the power management feature of DPDK is to be used.
70 Otherwise, the sys file folder ``/sys/devices/system/cpu/cpu0/cpufreq`` will not exist, and the CPU frequency- based power management cannot be used.
71 Consult the relevant BIOS documentation to determine how these settings can be accessed.
73 For example, on some Intel reference platform BIOS variants, the path to Enhanced Intel SpeedStepĀ® Technology is::
76 -> Processor Configuration
77 -> Enhanced Intel SpeedStepĀ® Tech
79 In addition, C3 and C6 should be enabled as well for power management. The path of C3 and C6 on the same platform BIOS is::
82 -> Processor Configuration
83 -> Processor C3 Advanced
84 -> Processor Configuration
87 Using Linux Core Isolation to Reduce Context Switches
88 -----------------------------------------------------
90 While the threads used by a DPDK application are pinned to logical cores on the system,
91 it is possible for the Linux scheduler to run other tasks on those cores also.
92 To help prevent additional workloads from running on those cores,
93 it is possible to use the ``isolcpus`` Linux kernel parameter to isolate them from the general Linux scheduler.
95 For example, if DPDK applications are to run on logical cores 2, 4 and 6,
96 the following should be added to the kernel parameter list:
98 .. code-block:: console
102 .. _High_Precision_Event_Timer:
104 High Precision Event Timer (HPET) Functionality
105 -----------------------------------------------
107 DPDK can support the system HPET as a timer source rather than the system default timers,
108 such as the core Time-Stamp Counter (TSC) on x86 systems.
109 To enable HPET support in DPDK:
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``
119 For an application to use the ``rte_get_hpet_cycles()`` and ``rte_get_hpet_hz()`` API calls,
120 and optionally to make the HPET the default time source for the rte_timer library,
121 the ``rte_eal_hpet_init()`` API call should be called at application initialization.
122 This API call will ensure that the HPET is accessible,
123 returning an error to the application if it is not.
125 For applications that require timing APIs, but not the HPET timer specifically,
126 it is recommended that the ``rte_get_timer_cycles()`` and ``rte_get_timer_hz()``
127 API calls be used instead of the HPET-specific APIs.
128 These generic APIs can work with either TSC or HPET time sources,
129 depending on what is requested by an application call to ``rte_eal_hpet_init()``,
130 if any, and on what is available on the system at runtime.