xref: /dpdk/doc/guides/prog_guide/service_cores.rst (revision fc49ed25f17c104e16d06046aa971dab66613d57)
1..  BSD LICENSE
2    Copyright(c) 2017 Intel Corporation. All rights reserved.
3    All rights reserved.
4
5    Redistribution and use in source and binary forms, with or without
6    modification, are permitted provided that the following conditions
7    are met:
8
9    * Redistributions of source code must retain the above copyright
10    notice, this list of conditions and the following disclaimer.
11    * Redistributions in binary form must reproduce the above copyright
12    notice, this list of conditions and the following disclaimer in
13    the documentation and/or other materials provided with the
14    distribution.
15    * Neither the name of Intel Corporation nor the names of its
16    contributors may be used to endorse or promote products derived
17    from this software without specific prior written permission.
18
19    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31Service Cores
32=============
33
34DPDK has a concept known as service cores, which enables a dynamic way of
35performing work on DPDK lcores. Service core support is built into the EAL, and
36an API is provided to optionally allow applications to control how the service
37cores are used at runtime.
38
39The service cores concept is built up out of services (components of DPDK that
40require CPU cycles to operate) and service cores (DPDK lcores, tasked with
41running services). The power of the service core concept is that the mapping
42between service cores and services can be configured to abstract away the
43difference between platforms and environments.
44
45For example, the Eventdev has hardware and software PMDs. Of these the software
46PMD requires an lcore to perform the scheduling operations, while the hardware
47PMD does not. With service cores, the application would not directly notice
48that the scheduling is done in software.
49
50For detailed information about the service core API, please refer to the docs.
51
52Service Core Initialization
53~~~~~~~~~~~~~~~~~~~~~~~~~~~
54
55There are two methods to having service cores in a DPDK application, either by
56using the service coremask, or by dynamically adding cores using the API.
57The simpler of the two is to pass the `-s` coremask argument to EAL, which will
58take any cores available in the main DPDK coremask, and if the bits are also set
59in the service coremask the cores become service-cores instead of DPDK
60application lcores.
61
62Enabling Services on Cores
63~~~~~~~~~~~~~~~~~~~~~~~~~~
64
65Each registered service can be individually mapped to a service core, or set of
66service cores. Enabling a service on a particular core means that the lcore in
67question will run the service. Disabling that core on the service stops the
68lcore in question from running the service.
69
70Using this method, it is possible to assign specific workloads to each
71service core, and map N workloads to M number of service cores. Each service
72lcore loops over the services that are enabled for that core, and invokes the
73function to run the service.
74
75Service Core Statistics
76~~~~~~~~~~~~~~~~~~~~~~~
77
78The service core library is capable of collecting runtime statistics like number
79of calls to a specific service, and number of cycles used by the service. The
80cycle count collection is dynamically configurable, allowing any application to
81profile the services running on the system at any time.
82