1 .. SPDX-License-Identifier: BSD-3-Clause
2 Copyright(c) 2010-2014 Intel Corporation.
4 .. _Enabling_Additional_Functionality:
6 Enabling Additional Functionality
7 =================================
9 .. _High_Precision_Event_Timer:
11 High Precision Event Timer (HPET) Functionality
12 -----------------------------------------------
17 The High Precision Timer (HPET) must be enabled in the platform BIOS if the HPET is to be used.
18 Otherwise, the Time Stamp Counter (TSC) is used by default.
19 The BIOS is typically accessed by pressing F2 while the platform is starting up.
20 The user can then navigate to the HPET option. On the Crystal Forest platform BIOS, the path is:
21 **Advanced -> PCH-IO Configuration -> High Precision Timer ->** (Change from Disabled to Enabled if necessary).
23 On a system that has already booted, the following command can be issued to check if HPET is enabled::
25 grep hpet /proc/timer_list
27 If no entries are returned, HPET must be enabled in the BIOS (as per the instructions above) and the system rebooted.
32 The DPDK makes use of the platform HPET timer by mapping the timer counter into the process address space, and as such,
33 requires that the ``HPET_MMAP`` kernel configuration option be enabled.
37 On Fedora, and other common distributions such as Ubuntu, the ``HPET_MMAP`` kernel option is not enabled by default.
38 To recompile the Linux kernel with this option enabled, please consult the distributions documentation for the relevant instructions.
40 Enabling HPET in the DPDK
41 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 By default, HPET support is disabled in the DPDK build configuration files.
44 To use HPET, the ``CONFIG_RTE_LIBEAL_USE_HPET`` setting should be changed to ``y``, which will enable the HPET settings at compile time.
46 For an application to use the ``rte_get_hpet_cycles()`` and ``rte_get_hpet_hz()`` API calls,
47 and optionally to make the HPET the default time source for the rte_timer library,
48 the new ``rte_eal_hpet_init()`` API call should be called at application initialization.
49 This API call will ensure that the HPET is accessible, returning an error to the application if it is not,
50 for example, if ``HPET_MMAP`` is not enabled in the kernel.
51 The application can then determine what action to take, if any, if the HPET is not available at run-time.
55 For applications that require timing APIs, but not the HPET timer specifically,
56 it is recommended that the ``rte_get_timer_cycles()`` and ``rte_get_timer_hz()`` API calls be used instead of the HPET-specific APIs.
57 These generic APIs can work with either TSC or HPET time sources, depending on what is requested by an application call to ``rte_eal_hpet_init()``,
58 if any, and on what is available on the system at runtime.
60 Running DPDK Applications Without Root Privileges
61 --------------------------------------------------------
65 The instructions below will allow running DPDK as non-root with older
66 Linux kernel versions. However, since version 4.0, the kernel does not allow
67 unprivileged processes to read the physical address information from
68 the pagemaps file, making it impossible for those processes to use HW
69 devices which require physical addresses
71 Although applications using the DPDK use network ports and other hardware resources directly,
72 with a number of small permission adjustments it is possible to run these applications as a user other than "root".
73 To do so, the ownership, or permissions, on the following Linux file system objects should be adjusted to ensure that
74 the Linux user account being used to run the DPDK application has access to them:
76 * All directories which serve as hugepage mount points, for example, ``/mnt/huge``
78 * The userspace-io device files in ``/dev``, for example, ``/dev/uio0``, ``/dev/uio1``, and so on
80 * The userspace-io sysfs config and resource files, for example for ``uio0``::
82 /sys/class/uio/uio0/device/config
83 /sys/class/uio/uio0/device/resource*
85 * If the HPET is to be used, ``/dev/hpet``
89 On some Linux installations, ``/dev/hugepages`` is also a hugepage mount point created by default.
91 Power Management and Power Saving Functionality
92 -----------------------------------------------
94 Enhanced Intel SpeedStep® Technology must be enabled in the platform BIOS if the power management feature of DPDK is to be used.
95 Otherwise, the sys file folder ``/sys/devices/system/cpu/cpu0/cpufreq`` will not exist, and the CPU frequency- based power management cannot be used.
96 Consult the relevant BIOS documentation to determine how these settings can be accessed.
98 For example, on some Intel reference platform BIOS variants, the path to Enhanced Intel SpeedStep® Technology is::
101 -> Processor Configuration
102 -> Enhanced Intel SpeedStep® Tech
104 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::
107 -> Processor Configuration
108 -> Processor C3 Advanced
109 -> Processor Configuration
112 Using Linux Core Isolation to Reduce Context Switches
113 -----------------------------------------------------
115 While the threads used by an DPDK application are pinned to logical cores on the system,
116 it is possible for the Linux scheduler to run other tasks on those cores also.
117 To help prevent additional workloads from running on those cores,
118 it is possible to use the ``isolcpus`` Linux kernel parameter to isolate them from the general Linux scheduler.
120 For example, if DPDK applications are to run on logical cores 2, 4 and 6,
121 the following should be added to the kernel parameter list:
123 .. code-block:: console
127 Loading the DPDK KNI Kernel Module
128 ----------------------------------
130 To run the DPDK Kernel NIC Interface (KNI) sample application, an extra kernel module (the kni module) must be loaded into the running kernel.
131 The module is found in the kmod sub-directory of the DPDK target directory.
132 Similar to the loading of the ``igb_uio`` module, this module should be loaded using the insmod command as shown below
133 (assuming that the current directory is the DPDK target directory):
135 .. code-block:: console
137 insmod kmod/rte_kni.ko
141 See the "Kernel NIC Interface Sample Application" chapter in the *DPDK Sample Applications User Guide* for more details.
143 Using Linux IOMMU Pass-Through to Run DPDK with Intel® VT-d
144 -----------------------------------------------------------
146 To enable Intel® VT-d in a Linux kernel, a number of kernel configuration options must be set. These include:
154 In addition, to run the DPDK with Intel® VT-d, the ``iommu=pt`` kernel parameter must be used when using ``igb_uio`` driver.
155 This results in pass-through of the DMAR (DMA Remapping) lookup in the host.
156 Also, if ``INTEL_IOMMU_DEFAULT_ON`` is not set in the kernel, the ``intel_iommu=on`` kernel parameter must be used too.
157 This ensures that the Intel IOMMU is being initialized as expected.
159 Please note that while using ``iommu=pt`` is compulsory for ``igb_uio driver``, the ``vfio-pci`` driver can actually work with both ``iommu=pt`` and ``iommu=on``.