4. Running DPDK Applications
4.1. Grant Lock pages in memory Privilege
Use of hugepages (“large pages” in Windows terminology) requires
SeLockMemoryPrivilege
for the user running an application.
- Open Local Security Policy snap-in, either:
- Control Panel / Computer Management / Local Security Policy;
- or Win+R, type
secpol
, press Enter.
- Open Local Policies / User Rights Assignment / Lock pages in memory.
- Add desired users or groups to the list of grantees.
- Privilege is applied upon next logon. In particular, if privilege has been granted to current user, a logoff is required before it is available.
See Large-Page Support in MSDN for details.
4.2. Load virt2phys Driver
Access to physical addresses is provided by a kernel-mode driver, virt2phys. It is mandatory at least for using hardware PMDs, but may also be required for mempools.
Refer to documentation in dpdk-kmods
repository for details on system
setup, driver build and installation. This driver is not signed, so signature
checking must be disabled to load it.
Warning
Disabling driver signature enforcement weakens OS security. It is discouraged in production environments.
Compiled package consists of virt2phys.inf
, virt2phys.cat
,
and virt2phys.sys
. It can be installed as follows
from Elevated Command Prompt:
pnputil /add-driver Z:\path\to\virt2phys.inf /install
On Windows Server additional steps are required:
- From Device Manager, Action menu, select “Add legacy hardware”.
- It will launch the “Add Hardware Wizard”. Click “Next”.
- Select second option “Install the hardware that I manually select from a list (Advanced)”.
- On the next screen, “Kernel bypass” will be shown as a device class.
- Select it, and click “Next”.
- The previously installed drivers will now be installed for the “Virtual to physical address translator” device.
When loaded successfully, the driver is shown in Device Manager as Virtual to physical address translator device under Kernel bypass category. Installed driver persists across reboots.
If DPDK is unable to communicate with the driver, a warning is printed on initialization (debug-level logs provide more details):
EAL: Cannot open virt2phys driver interface
4.3. Run the helloworld
Example
Navigate to the examples in the build directory and run dpdk-helloworld.exe.
cd C:\Users\me\dpdk\build\examples
dpdk-helloworld.exe -l 0-3
hello from core 1
hello from core 3
hello from core 0
hello from core 2