New upstream version 18.02
[deb_dpdk.git] / doc / guides / prog_guide / service_cores.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2017 Intel Corporation.
3
4 Service Cores
5 =============
6
7 DPDK has a concept known as service cores, which enables a dynamic way of
8 performing work on DPDK lcores. Service core support is built into the EAL, and
9 an API is provided to optionally allow applications to control how the service
10 cores are used at runtime.
11
12 The service cores concept is built up out of services (components of DPDK that
13 require CPU cycles to operate) and service cores (DPDK lcores, tasked with
14 running services). The power of the service core concept is that the mapping
15 between service cores and services can be configured to abstract away the
16 difference between platforms and environments.
17
18 For example, the Eventdev has hardware and software PMDs. Of these the software
19 PMD requires an lcore to perform the scheduling operations, while the hardware
20 PMD does not. With service cores, the application would not directly notice
21 that the scheduling is done in software.
22
23 For detailed information about the service core API, please refer to the docs.
24
25 Service Core Initialization
26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
28 There are two methods to having service cores in a DPDK application, either by
29 using the service coremask, or by dynamically adding cores using the API.
30 The simpler of the two is to pass the `-s` coremask argument to EAL, which will
31 take any cores available in the main DPDK coremask, and if the bits are also set
32 in the service coremask the cores become service-cores instead of DPDK
33 application lcores.
34
35 Enabling Services on Cores
36 ~~~~~~~~~~~~~~~~~~~~~~~~~~
37
38 Each registered service can be individually mapped to a service core, or set of
39 service cores. Enabling a service on a particular core means that the lcore in
40 question will run the service. Disabling that core on the service stops the
41 lcore in question from running the service.
42
43 Using this method, it is possible to assign specific workloads to each
44 service core, and map N workloads to M number of service cores. Each service
45 lcore loops over the services that are enabled for that core, and invokes the
46 function to run the service.
47
48 Service Core Statistics
49 ~~~~~~~~~~~~~~~~~~~~~~~
50
51 The service core library is capable of collecting runtime statistics like number
52 of calls to a specific service, and number of cycles used by the service. The
53 cycle count collection is dynamically configurable, allowing any application to
54 profile the services running on the system at any time.