xref: /dpdk/doc/guides/linux_gsg/sys_reqs.rst (revision df6aaab37f7364a5432506fb93406027f5524cbd)
11ab07743SBernard Iremonger..  BSD LICENSE
21ab07743SBernard Iremonger    Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
31ab07743SBernard Iremonger    All rights reserved.
41ab07743SBernard Iremonger
51ab07743SBernard Iremonger    Redistribution and use in source and binary forms, with or without
61ab07743SBernard Iremonger    modification, are permitted provided that the following conditions
71ab07743SBernard Iremonger    are met:
81ab07743SBernard Iremonger
91ab07743SBernard Iremonger    * Redistributions of source code must retain the above copyright
101ab07743SBernard Iremonger    notice, this list of conditions and the following disclaimer.
111ab07743SBernard Iremonger    * Redistributions in binary form must reproduce the above copyright
121ab07743SBernard Iremonger    notice, this list of conditions and the following disclaimer in
131ab07743SBernard Iremonger    the documentation and/or other materials provided with the
141ab07743SBernard Iremonger    distribution.
151ab07743SBernard Iremonger    * Neither the name of Intel Corporation nor the names of its
161ab07743SBernard Iremonger    contributors may be used to endorse or promote products derived
171ab07743SBernard Iremonger    from this software without specific prior written permission.
181ab07743SBernard Iremonger
191ab07743SBernard Iremonger    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
201ab07743SBernard Iremonger    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
211ab07743SBernard Iremonger    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
221ab07743SBernard Iremonger    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
231ab07743SBernard Iremonger    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
241ab07743SBernard Iremonger    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
251ab07743SBernard Iremonger    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
261ab07743SBernard Iremonger    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
271ab07743SBernard Iremonger    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
281ab07743SBernard Iremonger    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
291ab07743SBernard Iremonger    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
301ab07743SBernard Iremonger
311ab07743SBernard IremongerSystem Requirements
321ab07743SBernard Iremonger===================
331ab07743SBernard Iremonger
342e486e26SSiobhan ButlerThis chapter describes the packages required to compile the DPDK.
351ab07743SBernard Iremonger
361ab07743SBernard Iremonger.. note::
371ab07743SBernard Iremonger
382e486e26SSiobhan Butler    If the DPDK is being used on an Intel® Communications Chipset 89xx Series platform,
391ab07743SBernard Iremonger    please consult the *Intel® Communications Chipset 89xx Series Software for Linux* Getting Started Guide*.
401ab07743SBernard Iremonger
41*df6aaab3SChao ZhuBIOS Setting Prerequisite on x86
42*df6aaab3SChao Zhu--------------------------------
431ab07743SBernard Iremonger
442e486e26SSiobhan ButlerFor the majority of platforms, no special BIOS settings are needed to use basic DPDK functionality.
451ab07743SBernard IremongerHowever, for additional HPET timer and power management functionality,
461ab07743SBernard Iremongerand high performance of small packets on 40G NIC, BIOS setting changes may be needed.
471ab07743SBernard IremongerConsult :ref:`Chapter 5. Enabling Additional Functionality <Enabling_Additional_Functionality>`
481ab07743SBernard Iremongerfor more information on the required changes.
491ab07743SBernard Iremonger
502e486e26SSiobhan ButlerCompilation of the DPDK
512e486e26SSiobhan Butler-----------------------
521ab07743SBernard Iremonger
531ab07743SBernard Iremonger**Required Tools:**
541ab07743SBernard Iremonger
551ab07743SBernard Iremonger.. note::
561ab07743SBernard Iremonger
571ab07743SBernard Iremonger    Testing has been performed using Fedora* 18. The setup commands and installed packages needed on other systems may be different.
582e486e26SSiobhan Butler    For details on other Linux distributions and the versions tested, please consult the DPDK Release Notes.
591ab07743SBernard Iremonger
601ab07743SBernard Iremonger*   GNU  make
611ab07743SBernard Iremonger
621ab07743SBernard Iremonger*   coreutils:  cmp, sed, grep, arch
631ab07743SBernard Iremonger
64*df6aaab3SChao Zhu*   gcc: versions 4.5.x or later is recommended for i686/x86_64. versions 4.8.x or later is recommanded
65*df6aaab3SChao Zhu    for ppc_64. On some distributions, some specific compiler flags and linker flags are enabled by
66*df6aaab3SChao Zhu    default and affect performance (- fstack-protector, for example). Please refer to the documentation
67*df6aaab3SChao Zhu    of your distribution and to gcc -dumpspecs.
681ab07743SBernard Iremonger
69*df6aaab3SChao Zhu*   libc headers (glibc-devel.i686 / libc6-dev-i386; glibc-devel.x86_64 for 64-bit compilation on Intel
70*df6aaab3SChao Zhu    architecture; glibc-devel.ppc64 for 64 bit IBM Power architecture;)
711ab07743SBernard Iremonger
72*df6aaab3SChao Zhu*   Linux kernel headers or sources required to build kernel modules. (kernel - devel.x86_64;
73*df6aaab3SChao Zhu    kernel - devel.ppc64)
741ab07743SBernard Iremonger
751ab07743SBernard Iremonger*   Additional packages required for 32-bit compilation on 64-bit systems are:
761ab07743SBernard Iremonger
77*df6aaab3SChao Zhu    glibc.i686, libgcc.i686, libstdc++.i686 and glibc-devel.i686 for Intel i686/x86_64;
78*df6aaab3SChao Zhu
79*df6aaab3SChao Zhu    glibc.ppc64, libgcc.ppc64, libstdc++.ppc64 and glibc-devel.ppc64 for IBM ppc_64;
801ab07743SBernard Iremonger
812e486e26SSiobhan Butler*   Python, version 2.6 or 2.7, to use various helper scripts included in the DPDK package
821ab07743SBernard Iremonger
831ab07743SBernard Iremonger
841ab07743SBernard Iremonger**Optional Tools:**
851ab07743SBernard Iremonger
861ab07743SBernard Iremonger*   Intel®  C++ Compiler (icc). For installation, additional libraries may be required.
871ab07743SBernard Iremonger    See the icc Installation Guide found in the Documentation directory under the compiler installation.
881ab07743SBernard Iremonger    This release has been tested using version 12.1.
891ab07743SBernard Iremonger
90*df6aaab3SChao Zhu*   IBM® Advance ToolChain for Powerlinux. This is a set of open source development tools and runtime libraries
91*df6aaab3SChao Zhu    which allows users to take leading edge advantage of IBM's latest POWER hardware features on Linux. To install
92*df6aaab3SChao Zhu    it, see the IBM official installation document.
93*df6aaab3SChao Zhu
941ab07743SBernard Iremonger*   libpcap headers and libraries (libpcap-devel) to compile and use the libpcap-based poll-mode driver.
951ab07743SBernard Iremonger    This driver is disabled by default and can be enabled by setting CONFIG_RTE_LIBRTE_PMD_PCAP=y in the build time config file.
961ab07743SBernard Iremonger
972e486e26SSiobhan ButlerRunning DPDK Applications
982e486e26SSiobhan Butler-------------------------
991ab07743SBernard Iremonger
1002e486e26SSiobhan ButlerTo run an DPDK application, some customization may be required on the target machine.
1011ab07743SBernard Iremonger
1021ab07743SBernard IremongerSystem Software
1031ab07743SBernard Iremonger~~~~~~~~~~~~~~~
1041ab07743SBernard Iremonger
1051ab07743SBernard Iremonger**Required:**
1061ab07743SBernard Iremonger
1071ab07743SBernard Iremonger*   Kernel version >= 2.6.33
1081ab07743SBernard Iremonger
1091ab07743SBernard Iremonger    The kernel version in use can be checked using the command:
1101ab07743SBernard Iremonger
1111ab07743SBernard Iremonger    .. code-block:: console
1121ab07743SBernard Iremonger
1131ab07743SBernard Iremonger        uname -r
1141ab07743SBernard Iremonger
1152e486e26SSiobhan ButlerFor details of the patches needed to use the DPDK with earlier kernel versions,
1162e486e26SSiobhan Butlersee the DPDK FAQ included in the *DPDK Release Notes*.
1171ab07743SBernard IremongerNote also that Redhat* Linux* 6.2 and 6.3 uses a 2.6.32 kernel that already has all the necessary patches applied.
1181ab07743SBernard Iremonger
1191ab07743SBernard Iremonger*   glibc >= 2.7 (for features related to cpuset)
1201ab07743SBernard Iremonger
1211ab07743SBernard Iremonger    The version can be checked using the ldd --version command. A sample output is shown below:
1221ab07743SBernard Iremonger
1231ab07743SBernard Iremonger    .. code-block:: console
1241ab07743SBernard Iremonger
1251ab07743SBernard Iremonger        # ldd --version
1261ab07743SBernard Iremonger
1271ab07743SBernard Iremonger        ldd (GNU libc) 2.14.90
1281ab07743SBernard Iremonger        Copyright (C) 2011 Free Software Foundation, Inc.
1291ab07743SBernard Iremonger        This is free software; see the source for copying conditions. There is NO
1301ab07743SBernard Iremonger        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1311ab07743SBernard Iremonger        Written by Roland McGrath and Ulrich Drepper.
1321ab07743SBernard Iremonger
1331ab07743SBernard Iremonger*   Kernel configuration
1341ab07743SBernard Iremonger
1351ab07743SBernard Iremonger    In the Fedora* OS and other common distributions, such as Ubuntu*, or RedHat Enterprise Linux*,
1362e486e26SSiobhan Butler    the vendor supplied kernel configurations can be used to run most DPDK applications.
1371ab07743SBernard Iremonger
1382e486e26SSiobhan Butler    For other kernel builds, options which should be enabled for DPDK include:
1391ab07743SBernard Iremonger
1401ab07743SBernard Iremonger    *   UIO support
1411ab07743SBernard Iremonger
1421ab07743SBernard Iremonger    *   HUGETLBFS
1431ab07743SBernard Iremonger
1441ab07743SBernard Iremonger    *   PROC_PAGE_MONITOR  support
1451ab07743SBernard Iremonger
1461ab07743SBernard Iremonger    *   HPET and HPET_MMAP configuration options should also be enabled if HPET  support is required.
1471ab07743SBernard Iremonger        See :ref:`Section 5.1 High Precision Event Timer (HPET) Functionality <High_Precision_Event_Timer>` for more details.
1481ab07743SBernard Iremonger
1491ab07743SBernard IremongerUse of Hugepages in the Linux* Environment
1501ab07743SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1511ab07743SBernard Iremonger
1521ab07743SBernard IremongerHugepage support is required for the large memory pool allocation used for packet buffers
1531ab07743SBernard Iremonger(the HUGETLBFS option must be enabled in the running kernel as indicated in Section 2.3).
1541ab07743SBernard IremongerBy using hugepage allocations, performance is increased since fewer pages are needed,
1551ab07743SBernard Iremongerand therefore less Translation Lookaside Buffers (TLBs, high speed translation caches),
1561ab07743SBernard Iremongerwhich reduce the time it takes to translate a virtual page address to a physical page address.
1571ab07743SBernard IremongerWithout hugepages, high TLB miss rates would occur with the standard 4k page size, slowing performance.
1581ab07743SBernard Iremonger
1592e486e26SSiobhan ButlerReserving Hugepages for DPDK Use
1602e486e26SSiobhan Butler^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1611ab07743SBernard Iremonger
1621ab07743SBernard IremongerThe allocation of hugepages should be done at boot time or as soon as possible after system boot
1631ab07743SBernard Iremongerto prevent memory from being fragmented in physical memory.
1641ab07743SBernard IremongerTo reserve hugepages at boot time, a parameter is passed to the Linux* kernel on the kernel command line.
1651ab07743SBernard Iremonger
1661ab07743SBernard IremongerFor 2 MB pages, just pass the hugepages option to the kernel. For example, to reserve 1024 pages of 2 MB, use:
1671ab07743SBernard Iremonger
1681ab07743SBernard Iremonger.. code-block:: console
1691ab07743SBernard Iremonger
1701ab07743SBernard Iremonger    hugepages=1024
1711ab07743SBernard Iremonger
1721ab07743SBernard IremongerFor other hugepage sizes, for example 1G pages, the size must be specified explicitly and
1731ab07743SBernard Iremongercan also be optionally set as the default hugepage size for the system.
1741ab07743SBernard IremongerFor example, to reserve 4G of hugepage memory in the form of four 1G pages, the following options should be passed to the kernel:
1751ab07743SBernard Iremonger
1761ab07743SBernard Iremonger.. code-block:: console
1771ab07743SBernard Iremonger
1781ab07743SBernard Iremonger    default_hugepagesz=1G hugepagesz=1G hugepages=4
1791ab07743SBernard Iremonger
1801ab07743SBernard Iremonger.. note::
1811ab07743SBernard Iremonger
182*df6aaab3SChao Zhu    The hugepage sizes that a CPU supports can be determined from the CPU flags on Intel architecture.
1831ab07743SBernard Iremonger    If pse exists, 2M hugepages are supported; if pdpe1gb exists, 1G hugepages are supported.
184*df6aaab3SChao Zhu    On IBM Power architecture, the supported hugepage sizes are 16MB and 16GB.
1851ab07743SBernard Iremonger
1861ab07743SBernard Iremonger.. note::
1871ab07743SBernard Iremonger
1881ab07743SBernard Iremonger    For 64-bit applications, it is recommended to use 1 GB hugepages if the platform supports them.
1891ab07743SBernard Iremonger
1901ab07743SBernard IremongerIn the case of a dual-socket NUMA system,
1911ab07743SBernard Iremongerthe number of hugepages reserved at boot time is generally divided equally between the two sockets
1921ab07743SBernard Iremonger(on the assumption that sufficient memory is present on both sockets).
1931ab07743SBernard Iremonger
1941ab07743SBernard IremongerSee the Documentation/kernel-parameters.txt file in your Linux* source tree for further details of these and other kernel options.
1951ab07743SBernard Iremonger
1961ab07743SBernard Iremonger**Alternative:**
1971ab07743SBernard Iremonger
1981ab07743SBernard IremongerFor 2 MB pages, there is also the option of allocating hugepages after the system has booted.
1991ab07743SBernard IremongerThis is done by echoing the number of hugepages required to a nr_hugepages file in the /sys/devices/ directory.
2001ab07743SBernard IremongerFor a single-node system, the command to use is as follows (assuming that 1024 pages are required):
2011ab07743SBernard Iremonger
2021ab07743SBernard Iremonger.. code-block:: console
2031ab07743SBernard Iremonger
2041ab07743SBernard Iremonger    echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
2051ab07743SBernard Iremonger
2061ab07743SBernard IremongerOn a NUMA machine, pages should be allocated explicitly on separate nodes:
2071ab07743SBernard Iremonger
2081ab07743SBernard Iremonger.. code-block:: console
2091ab07743SBernard Iremonger
2101ab07743SBernard Iremonger    echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
2111ab07743SBernard Iremonger    echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
2121ab07743SBernard Iremonger
2131ab07743SBernard Iremonger.. note::
2141ab07743SBernard Iremonger
2151ab07743SBernard Iremonger    For 1G pages, it is not possible to reserve the hugepage memory after the system has booted.
2161ab07743SBernard Iremonger
2172e486e26SSiobhan ButlerUsing Hugepages with the DPDK
2182e486e26SSiobhan Butler^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2191ab07743SBernard Iremonger
2202e486e26SSiobhan ButlerOnce the hugepage memory is reserved, to make the memory available for DPDK use, perform the following steps:
2211ab07743SBernard Iremonger
2221ab07743SBernard Iremonger.. code-block:: console
2231ab07743SBernard Iremonger
2241ab07743SBernard Iremonger    mkdir /mnt/huge
2251ab07743SBernard Iremonger    mount -t hugetlbfs nodev /mnt/huge
2261ab07743SBernard Iremonger
2271ab07743SBernard IremongerThe mount point can be made permanent across reboots, by adding the following line to the /etc/fstab file:
2281ab07743SBernard Iremonger
2291ab07743SBernard Iremonger.. code-block:: console
2301ab07743SBernard Iremonger
2311ab07743SBernard Iremonger    nodev /mnt/huge hugetlbfs defaults 0 0
2321ab07743SBernard Iremonger
2331ab07743SBernard IremongerFor 1GB pages, the page size must be specified as a mount option:
2341ab07743SBernard Iremonger
2351ab07743SBernard Iremonger.. code-block:: console
2361ab07743SBernard Iremonger
2371ab07743SBernard Iremonger    nodev /mnt/huge_1GB hugetlbfs pagesize=1GB 0 0
2381ab07743SBernard Iremonger
2391ab07743SBernard IremongerXen Domain0 Support in the Linux* Environment
2401ab07743SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2411ab07743SBernard Iremonger
2421ab07743SBernard IremongerThe existing memory management implementation is based on the Linux* kernel hugepage mechanism.
2432e486e26SSiobhan ButlerOn the Xen hypervisor, hugepage support for DomainU (DomU) Guests means that DPDK applications work as normal for guests.
2441ab07743SBernard Iremonger
2451ab07743SBernard IremongerHowever, Domain0 (Dom0) does not support hugepages.
2461ab07743SBernard IremongerTo work around this limitation, a new kernel module rte_dom0_mm is added to facilitate the allocation and mapping of memory via
2471ab07743SBernard Iremonger**IOCTL** (allocation) and **MMAP** (mapping).
2481ab07743SBernard Iremonger
2492e486e26SSiobhan ButlerEnabling Xen Dom0 Mode in the DPDK
2502e486e26SSiobhan Butler^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2511ab07743SBernard Iremonger
2522e486e26SSiobhan ButlerBy default, Xen Dom0 mode is disabled in the DPDK build configuration files.
2531ab07743SBernard IremongerTo support Xen Dom0, the CONFIG_RTE_LIBRTE_XEN_DOM0 setting should be changed to “y”, which enables the Xen Dom0 mode at compile time.
2541ab07743SBernard Iremonger
2551ab07743SBernard IremongerFurthermore, the CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID setting should also be changed to “y” in the case of the wrong socket ID being received.
2561ab07743SBernard Iremonger
2572e486e26SSiobhan ButlerLoading the DPDK rte_dom0_mm Module
2582e486e26SSiobhan Butler^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2591ab07743SBernard Iremonger
2602e486e26SSiobhan ButlerTo run any DPDK application on Xen Dom0, the rte_dom0_mm module must be loaded into the running kernel with rsv_memsize option.
2612e486e26SSiobhan ButlerThe module is found in the kmod sub-directory of the DPDK target directory.
2622e486e26SSiobhan ButlerThis module should be loaded using the insmod command as shown below (assuming that the current directory is the DPDK target directory):
2631ab07743SBernard Iremonger
2641ab07743SBernard Iremonger.. code-block:: console
2651ab07743SBernard Iremonger
2661ab07743SBernard Iremonger    sudo insmod kmod/rte_dom0_mm.ko rsv_memsize=X
2671ab07743SBernard Iremonger
2681ab07743SBernard IremongerThe value X cannot be greater than 4096(MB).
2691ab07743SBernard Iremonger
2702e486e26SSiobhan ButlerConfiguring Memory for DPDK Use
2712e486e26SSiobhan Butler^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2721ab07743SBernard Iremonger
2731ab07743SBernard IremongerAfter the rte_dom0_mm.ko kernel module has been loaded, the user must configure the memory size for DPDK usage.
2741ab07743SBernard IremongerThis is done by echoing the memory size to a memsize file in the /sys/devices/ directory.
2751ab07743SBernard IremongerUse the following command (assuming that 2048 MB is required):
2761ab07743SBernard Iremonger
2771ab07743SBernard Iremonger.. code-block:: console
2781ab07743SBernard Iremonger
279e8d6f51aSJincheng Miao    echo 2048 > /sys/kernel/mm/dom0-mm/memsize-mB/memsize
2801ab07743SBernard Iremonger
2811ab07743SBernard IremongerThe user can also check how much memory has already been used:
2821ab07743SBernard Iremonger
2831ab07743SBernard Iremonger.. code-block:: console
2841ab07743SBernard Iremonger
2851ab07743SBernard Iremonger    cat /sys/kernel/mm/dom0-mm/memsize-mB/memsize_rsvd
2861ab07743SBernard Iremonger
2871ab07743SBernard IremongerXen Domain0 does not support NUMA configuration, as a result the --socket-mem command line option is invalid for Xen Domain0.
2881ab07743SBernard Iremonger
2891ab07743SBernard Iremonger.. note::
2901ab07743SBernard Iremonger
2911ab07743SBernard Iremonger    The memsize value cannot be greater than the rsv_memsize value.
2921ab07743SBernard Iremonger
2932e486e26SSiobhan ButlerRunning the DPDK Application on Xen Domain0
2942e486e26SSiobhan Butler^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2951ab07743SBernard Iremonger
2962e486e26SSiobhan ButlerTo run the DPDK application on Xen Domain0, an extra command line option --xen-dom0 is required.
297