xref: /dpdk/doc/guides/prog_guide/service_cores.rst (revision 841e87df43e4c3c60ab1b6361130b628afd156ec)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2017 Intel Corporation.
3
4Service Cores
5=============
6
7DPDK has a concept known as service cores, which enables a dynamic way of
8performing work on DPDK lcores. Service core support is built into the EAL, and
9an API is provided to optionally allow applications to control how the service
10cores are used at runtime.
11
12The service cores concept is built up out of services (components of DPDK that
13require CPU cycles to operate) and service cores (DPDK lcores, tasked with
14running services). The power of the service core concept is that the mapping
15between service cores and services can be configured to abstract away the
16difference between platforms and environments.
17
18For example, the Eventdev has hardware and software PMDs. Of these the software
19PMD requires an lcore to perform the scheduling operations, while the hardware
20PMD does not. With service cores, the application would not directly notice
21that the scheduling is done in software.
22
23For detailed information about the service core API, please refer to the docs.
24
25Service Core Initialization
26~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
28There are two methods to having service cores in a DPDK application, either by
29using the service coremask, or by dynamically adding cores using the API.
30The simpler of the two is to pass the `-s` coremask argument to EAL, which will
31take any cores available in the main DPDK coremask, and if the bits are also set
32in the service coremask the cores become service-cores instead of DPDK
33application lcores.
34
35Enabling Services on Cores
36~~~~~~~~~~~~~~~~~~~~~~~~~~
37
38Each registered service can be individually mapped to a service core, or set of
39service cores. Enabling a service on a particular core means that the lcore in
40question will run the service. Disabling that core on the service stops the
41lcore in question from running the service.
42
43Using this method, it is possible to assign specific workloads to each
44service core, and map N workloads to M number of service cores. Each service
45lcore loops over the services that are enabled for that core, and invokes the
46function to run the service.
47
48Service Core Statistics
49~~~~~~~~~~~~~~~~~~~~~~~
50
51The service core library is capable of collecting runtime statistics like number
52of calls to a specific service, and number of cycles used by the service. The
53cycle count collection is dynamically configurable, allowing any application to
54profile the services running on the system at any time.
55
56Service Core Tracing
57~~~~~~~~~~~~~~~~~~~~
58
59The service core library is instrumented with tracepoints using the DPDK Trace
60Library. These tracepoints allow you to track the service and logical cores
61state. To activate tracing when launching a DPDK program it is necessary to use the
62``--trace`` option to specify a regular expression to select which tracepoints
63to enable. Here is an example if you want to only specify service core tracing::
64
65  ./dpdk/examples/service_cores/build/service_cores --trace="lib.eal.thread*" --trace="lib.eal.service*"
66
67See the :doc:`trace_lib` documentation for details.
68