xref: /dpdk/doc/guides/windows_gsg/run_apps.rst (revision 68a03efeed657e6e05f281479b33b51102797e15)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2020 Dmitry Kozlyuk
3
4Running DPDK Applications
5=========================
6
7Grant *Lock pages in memory* Privilege
8--------------------------------------
9
10Use of hugepages ("large pages" in Windows terminology) requires
11``SeLockMemoryPrivilege`` for the user running an application.
12
131. Open *Local Security Policy* snap-in, either:
14
15   * Control Panel / Computer Management / Local Security Policy;
16   * or Win+R, type ``secpol``, press Enter.
17
182. Open *Local Policies / User Rights Assignment / Lock pages in memory.*
19
203. Add desired users or groups to the list of grantees.
21
224. Privilege is applied upon next logon. In particular, if privilege has been
23   granted to current user, a logoff is required before it is available.
24
25See `Large-Page Support`_ in MSDN for details.
26
27.. _Large-Page Support: https://docs.microsoft.com/en-us/windows/win32/memory/large-page-support
28
29
30Load virt2phys Driver
31---------------------
32
33Access to physical addresses is provided by a kernel-mode driver, virt2phys.
34It is mandatory at least for using hardware PMDs, but may also be required
35for mempools.
36
37Refer to documentation in ``dpdk-kmods`` repository for details on system
38setup, driver build and installation. This driver is not signed, so signature
39checking must be disabled to load it.
40
41.. warning::
42
43    Disabling driver signature enforcement weakens OS security.
44    It is discouraged in production environments.
45
46Compiled package consists of ``virt2phys.inf``, ``virt2phys.cat``,
47and ``virt2phys.sys``. It can be installed as follows
48from Elevated Command Prompt:
49
50.. code-block:: console
51
52    pnputil /add-driver Z:\path\to\virt2phys.inf /install
53
54On Windows Server additional steps are required:
55
561. From Device Manager, Action menu, select "Add legacy hardware".
572. It will launch the "Add Hardware Wizard". Click "Next".
583. Select second option "Install the hardware that I manually select
59   from a list (Advanced)".
604. On the next screen, "Kernel bypass" will be shown as a device class.
615. Select it, and click "Next".
626. The previously installed drivers will now be installed for the
63   "Virtual to physical address translator" device.
64
65When loaded successfully, the driver is shown in *Device Manager* as *Virtual
66to physical address translator* device under *Kernel bypass* category.
67Installed driver persists across reboots.
68
69If DPDK is unable to communicate with the driver, a warning is printed
70on initialization (debug-level logs provide more details):
71
72.. code-block:: text
73
74    EAL: Cannot open virt2phys driver interface
75
76
77
78Run the ``helloworld`` Example
79------------------------------
80
81Navigate to the examples in the build directory and run `dpdk-helloworld.exe`.
82
83.. code-block:: console
84
85    cd C:\Users\me\dpdk\build\examples
86    dpdk-helloworld.exe -l 0-3
87    hello from core 1
88    hello from core 3
89    hello from core 0
90    hello from core 2
91