xref: /dpdk/doc/guides/linux_gsg/sys_reqs.rst (revision 3cc6ecfdfe85d2577fef30e1791bb7534e3d60b3)
15630257fSFerruh Yigit..  SPDX-License-Identifier: BSD-3-Clause
25630257fSFerruh Yigit    Copyright(c) 2010-2014 Intel Corporation.
31ab07743SBernard Iremonger
41ab07743SBernard IremongerSystem Requirements
51ab07743SBernard Iremonger===================
61ab07743SBernard Iremonger
72e486e26SSiobhan ButlerThis chapter describes the packages required to compile the DPDK.
81ab07743SBernard Iremonger
91ab07743SBernard Iremonger.. note::
101ab07743SBernard Iremonger
112e486e26SSiobhan Butler    If the DPDK is being used on an Intel® Communications Chipset 89xx Series platform,
1229c67340SJohn McNamara    please consult the *Intel® Communications Chipset 89xx Series Software for Linux Getting Started Guide*.
131ab07743SBernard Iremonger
14df6aaab3SChao ZhuBIOS Setting Prerequisite on x86
15df6aaab3SChao Zhu--------------------------------
161ab07743SBernard Iremonger
172e486e26SSiobhan ButlerFor the majority of platforms, no special BIOS settings are needed to use basic DPDK functionality.
181ab07743SBernard IremongerHowever, for additional HPET timer and power management functionality,
19d239f17dSShahaf Shulerand high performance of small packets, BIOS setting changes may be needed.
2029c67340SJohn McNamaraConsult the section on :ref:`Enabling Additional Functionality <Enabling_Additional_Functionality>`
211ab07743SBernard Iremongerfor more information on the required changes.
221ab07743SBernard Iremonger
23ccf5fd60SJohn McNamara.. note::
24ccf5fd60SJohn McNamara
25ccf5fd60SJohn McNamara   If UEFI secure boot is enabled, the Linux kernel may disallow the use of
26ccf5fd60SJohn McNamara   UIO on the system. Therefore, devices for use by DPDK should be bound to the
27ccf5fd60SJohn McNamara   ``vfio-pci`` kernel module rather than ``igb_uio`` or ``uio_pci_generic``.
28ccf5fd60SJohn McNamara   For more details see :ref:`linux_gsg_binding_kernel`.
29ccf5fd60SJohn McNamara
302e486e26SSiobhan ButlerCompilation of the DPDK
312e486e26SSiobhan Butler-----------------------
321ab07743SBernard Iremonger
3306673193SJohn McNamara**Required Tools and Libraries:**
341ab07743SBernard Iremonger
351ab07743SBernard Iremonger.. note::
361ab07743SBernard Iremonger
37e4f11376SHarry van Haaren    The setup commands and installed packages needed on various systems may be different.
38e4f11376SHarry van Haaren    For details on Linux distributions and the versions tested, please consult the DPDK Release Notes.
391ab07743SBernard Iremonger
40*3cc6ecfdSCiara Power*   General development tools including a supported C compiler such as gcc (version 4.9+) or clang (version 3.4+).
411ab07743SBernard Iremonger
42f6412d75SBruce Richardson    * For RHEL/Fedora systems these can be installed using ``dnf groupinstall "Development Tools"``
431ab07743SBernard Iremonger
44f6412d75SBruce Richardson    * For Ubuntu/Debian systems these can be installed using ``apt install build-essential``
451ab07743SBernard Iremonger
46f6412d75SBruce Richardson*   Python, recommended version 3.5+.
471ab07743SBernard Iremonger
48f6412d75SBruce Richardson    * Python v3.5+ is needed to build DPDK using meson and ninja
491ab07743SBernard Iremonger
50f6412d75SBruce Richardson    * Python 2.7+ or 3.2+, to use various helper scripts included in the DPDK package.
511ab07743SBernard Iremonger
52f6412d75SBruce Richardson*   Meson (version 0.47.1+) and ninja
53df6aaab3SChao Zhu
54f6412d75SBruce Richardson    * ``meson`` & ``ninja-build`` packages in most Linux distributions
551ab07743SBernard Iremonger
56f6412d75SBruce Richardson    * If the packaged version is below the minimum version, the latest versions
57f6412d75SBruce Richardson      can be installed from Python's "pip" repository: ``pip3 install meson ninja``
58d3aa5274SDaniel Mrzyglod
59ee57170cSYong Wang*   Library for handling NUMA (Non Uniform Memory Access).
60ee57170cSYong Wang
61f6412d75SBruce Richardson    * ``numactl-devel`` in RHEL/Fedora;
62ee57170cSYong Wang
63f6412d75SBruce Richardson    * ``libnuma-dev`` in Debian/Ubuntu;
6406673193SJohn McNamara
65f6412d75SBruce Richardson*   Linux kernel headers or sources required to build kernel modules.
661ab07743SBernard Iremonger
67e090fdb4SJohn McNamara.. note::
68e090fdb4SJohn McNamara
69e090fdb4SJohn McNamara   Please ensure that the latest patches are applied to third party libraries
70e090fdb4SJohn McNamara   and software to avoid any known vulnerabilities.
71e090fdb4SJohn McNamara
721ab07743SBernard Iremonger
731ab07743SBernard Iremonger**Optional Tools:**
741ab07743SBernard Iremonger
751ab07743SBernard Iremonger*   Intel® C++ Compiler (icc). For installation, additional libraries may be required.
761ab07743SBernard Iremonger    See the icc Installation Guide found in the Documentation directory under the compiler installation.
771ab07743SBernard Iremonger
78df6aaab3SChao Zhu*   IBM® Advance ToolChain for Powerlinux. This is a set of open source development tools and runtime libraries
79df6aaab3SChao Zhu    which allows users to take leading edge advantage of IBM's latest POWER hardware features on Linux. To install
80df6aaab3SChao Zhu    it, see the IBM official installation document.
81df6aaab3SChao Zhu
82f6412d75SBruce Richardson**Additional Libraries**
831ab07743SBernard Iremonger
84f6412d75SBruce RichardsonA number of DPDK components, such as libraries and poll-mode drivers (PMDs) have additional dependencies.
85*3cc6ecfdSCiara PowerFor DPDK builds, the presence or absence of these dependencies will be automatically detected
86*3cc6ecfdSCiara Powerenabling or disabling the relevant components appropriately.
87f6412d75SBruce Richardson
88f6412d75SBruce RichardsonIn each case, the relevant library development package (``-devel`` or ``-dev``) is needed to build the DPDK components.
89f6412d75SBruce Richardson
90f6412d75SBruce RichardsonFor libraries the additional dependencies include:
91f6412d75SBruce Richardson
92f6412d75SBruce Richardson*   libarchive: for some unit tests using tar to get their resources.
93f6412d75SBruce Richardson
94f6412d75SBruce Richardson*   libelf: to compile and use the bpf library.
95f6412d75SBruce Richardson
96f6412d75SBruce RichardsonFor poll-mode drivers, the additional dependencies for each driver can be
97f6412d75SBruce Richardsonfound in that driver's documentation in the relevant DPDK guide document,
98f6412d75SBruce Richardsone.g. :doc:`../nics/index`
9918aa3272SThomas Monjalon
10018aa3272SThomas Monjalon
1012e486e26SSiobhan ButlerRunning DPDK Applications
1022e486e26SSiobhan Butler-------------------------
1031ab07743SBernard Iremonger
1042e486e26SSiobhan ButlerTo run an DPDK application, some customization may be required on the target machine.
1051ab07743SBernard Iremonger
1061ab07743SBernard IremongerSystem Software
1071ab07743SBernard Iremonger~~~~~~~~~~~~~~~
1081ab07743SBernard Iremonger
1091ab07743SBernard Iremonger**Required:**
1101ab07743SBernard Iremonger
111d993b012SThomas Monjalon*   Kernel version >= 3.16
11290f3229fSStephen Hemminger
11390f3229fSStephen Hemminger    The kernel version required is based on the oldest long term stable kernel available
11490f3229fSStephen Hemminger    at kernel.org when the DPDK version is in development.
115d993b012SThomas Monjalon    Compatibility for recent distribution kernels will be kept, notably RHEL/CentOS 7.
1161ab07743SBernard Iremonger
11729c67340SJohn McNamara    The kernel version in use can be checked using the command::
1181ab07743SBernard Iremonger
1191ab07743SBernard Iremonger        uname -r
1201ab07743SBernard Iremonger
1211ab07743SBernard Iremonger*   glibc >= 2.7 (for features related to cpuset)
1221ab07743SBernard Iremonger
12329c67340SJohn McNamara    The version can be checked using the ``ldd --version`` command.
1241ab07743SBernard Iremonger
1251ab07743SBernard Iremonger*   Kernel configuration
1261ab07743SBernard Iremonger
12729c67340SJohn McNamara    In the Fedora OS and other common distributions, such as Ubuntu, or Red Hat Enterprise Linux,
1282e486e26SSiobhan Butler    the vendor supplied kernel configurations can be used to run most DPDK applications.
1291ab07743SBernard Iremonger
1302e486e26SSiobhan Butler    For other kernel builds, options which should be enabled for DPDK include:
1311ab07743SBernard Iremonger
1321ab07743SBernard Iremonger    *   HUGETLBFS
1331ab07743SBernard Iremonger
1341ab07743SBernard Iremonger    *   PROC_PAGE_MONITOR  support
1351ab07743SBernard Iremonger
1361ab07743SBernard Iremonger    *   HPET and HPET_MMAP configuration options should also be enabled if HPET  support is required.
13729c67340SJohn McNamara        See the section on :ref:`High Precision Event Timer (HPET) Functionality <High_Precision_Event_Timer>` for more details.
1381ab07743SBernard Iremonger
139b932ebcbSQian Xu.. _linux_gsg_hugepages:
140b932ebcbSQian Xu
14129c67340SJohn McNamaraUse of Hugepages in the Linux Environment
14229c67340SJohn McNamara~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1431ab07743SBernard Iremonger
1441ab07743SBernard IremongerHugepage support is required for the large memory pool allocation used for packet buffers
14529c67340SJohn McNamara(the HUGETLBFS option must be enabled in the running kernel as indicated the previous section).
1461ab07743SBernard IremongerBy using hugepage allocations, performance is increased since fewer pages are needed,
1471ab07743SBernard Iremongerand therefore less Translation Lookaside Buffers (TLBs, high speed translation caches),
1481ab07743SBernard Iremongerwhich reduce the time it takes to translate a virtual page address to a physical page address.
1491ab07743SBernard IremongerWithout hugepages, high TLB miss rates would occur with the standard 4k page size, slowing performance.
1501ab07743SBernard Iremonger
1512e486e26SSiobhan ButlerReserving Hugepages for DPDK Use
1522e486e26SSiobhan Butler^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1531ab07743SBernard Iremonger
1541ab07743SBernard IremongerThe allocation of hugepages should be done at boot time or as soon as possible after system boot
1551ab07743SBernard Iremongerto prevent memory from being fragmented in physical memory.
15629c67340SJohn McNamaraTo reserve hugepages at boot time, a parameter is passed to the Linux kernel on the kernel command line.
1571ab07743SBernard Iremonger
15829c67340SJohn McNamaraFor 2 MB pages, just pass the hugepages option to the kernel. For example, to reserve 1024 pages of 2 MB, use::
1591ab07743SBernard Iremonger
1601ab07743SBernard Iremonger    hugepages=1024
1611ab07743SBernard Iremonger
1621ab07743SBernard IremongerFor other hugepage sizes, for example 1G pages, the size must be specified explicitly and
1631ab07743SBernard Iremongercan also be optionally set as the default hugepage size for the system.
16429c67340SJohn McNamaraFor example, to reserve 4G of hugepage memory in the form of four 1G pages, the following options should be passed to the kernel::
1651ab07743SBernard Iremonger
1661ab07743SBernard Iremonger    default_hugepagesz=1G hugepagesz=1G hugepages=4
1671ab07743SBernard Iremonger
1681ab07743SBernard Iremonger.. note::
1691ab07743SBernard Iremonger
170df6aaab3SChao Zhu    The hugepage sizes that a CPU supports can be determined from the CPU flags on Intel architecture.
1711ab07743SBernard Iremonger    If pse exists, 2M hugepages are supported; if pdpe1gb exists, 1G hugepages are supported.
172df6aaab3SChao Zhu    On IBM Power architecture, the supported hugepage sizes are 16MB and 16GB.
1731ab07743SBernard Iremonger
1741ab07743SBernard Iremonger.. note::
1751ab07743SBernard Iremonger
1761ab07743SBernard Iremonger    For 64-bit applications, it is recommended to use 1 GB hugepages if the platform supports them.
1771ab07743SBernard Iremonger
1781ab07743SBernard IremongerIn the case of a dual-socket NUMA system,
1791ab07743SBernard Iremongerthe number of hugepages reserved at boot time is generally divided equally between the two sockets
1801ab07743SBernard Iremonger(on the assumption that sufficient memory is present on both sockets).
1811ab07743SBernard Iremonger
182e91ae7e0SRami RosenSee the Documentation/admin-guide/kernel-parameters.txt file in your Linux source tree for further details of these and other kernel options.
1831ab07743SBernard Iremonger
1841ab07743SBernard Iremonger**Alternative:**
1851ab07743SBernard Iremonger
1861ab07743SBernard IremongerFor 2 MB pages, there is also the option of allocating hugepages after the system has booted.
18729c67340SJohn McNamaraThis is done by echoing the number of hugepages required to a nr_hugepages file in the ``/sys/devices/`` directory.
18829c67340SJohn McNamaraFor a single-node system, the command to use is as follows (assuming that 1024 pages are required)::
1891ab07743SBernard Iremonger
1901ab07743SBernard Iremonger    echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
1911ab07743SBernard Iremonger
19229c67340SJohn McNamaraOn a NUMA machine, pages should be allocated explicitly on separate nodes::
1931ab07743SBernard Iremonger
1941ab07743SBernard Iremonger    echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
1951ab07743SBernard Iremonger    echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
1961ab07743SBernard Iremonger
1971ab07743SBernard Iremonger.. note::
1981ab07743SBernard Iremonger
1991ab07743SBernard Iremonger    For 1G pages, it is not possible to reserve the hugepage memory after the system has booted.
2001ab07743SBernard Iremonger
2012e486e26SSiobhan ButlerUsing Hugepages with the DPDK
2022e486e26SSiobhan Butler^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2031ab07743SBernard Iremonger
20429c67340SJohn McNamaraOnce the hugepage memory is reserved, to make the memory available for DPDK use, perform the following steps::
2051ab07743SBernard Iremonger
2061ab07743SBernard Iremonger    mkdir /mnt/huge
2071ab07743SBernard Iremonger    mount -t hugetlbfs nodev /mnt/huge
2081ab07743SBernard Iremonger
20929c67340SJohn McNamaraThe mount point can be made permanent across reboots, by adding the following line to the ``/etc/fstab`` file::
2101ab07743SBernard Iremonger
2111ab07743SBernard Iremonger    nodev /mnt/huge hugetlbfs defaults 0 0
2121ab07743SBernard Iremonger
21329c67340SJohn McNamaraFor 1GB pages, the page size must be specified as a mount option::
2141ab07743SBernard Iremonger
2151ab07743SBernard Iremonger    nodev /mnt/huge_1GB hugetlbfs pagesize=1GB 0 0
216