mbuf: remove control mbuf
[dpdk.git] / doc / guides / prog_guide / power_man.rst
1 ..  BSD LICENSE
2     Copyright(c) 2010-2014 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
31 Power Management
32 ================
33
34 The DPDK Power Management feature allows users space applications to save power
35 by dynamically adjusting CPU frequency or entering into different C-States.
36
37 *   Adjusting the CPU frequency dynamically according to the utilization of RX queue.
38
39 *   Entering into different deeper C-States according to the adaptive algorithms to speculate
40     brief periods of time suspending the application if no packets are received.
41
42 The interfaces for adjusting the operating CPU frequency are in the power management library.
43 C-State control is implemented in applications according to the different use cases.
44
45 CPU Frequency Scaling
46 ---------------------
47
48 The Linux kernel provides a cpufreq module for CPU frequency scaling for each lcore.
49 For example, for cpuX, /sys/devices/system/cpu/cpuX/cpufreq/ has the following sys files for frequency scaling:
50
51 *   affected_cpus
52
53 *   bios_limit
54
55 *   cpuinfo_cur_freq
56
57 *   cpuinfo_max_freq
58
59 *   cpuinfo_min_freq
60
61 *   cpuinfo_transition_latency
62
63 *   related_cpus
64
65 *   scaling_available_frequencies
66
67 *   scaling_available_governors
68
69 *   scaling_cur_freq
70
71 *   scaling_driver
72
73 *   scaling_governor
74
75 *   scaling_max_freq
76
77 *   scaling_min_freq
78
79 *   scaling_setspeed
80
81 In the DPDK, scaling_governor is configured in user space.
82 Then, a user space application can prompt the kernel by writing scaling_setspeed to adjust the CPU frequency
83 according to the strategies defined by the user space application.
84
85 Core-load Throttling through C-States
86 -------------------------------------
87
88 Core state can be altered by speculative sleeps whenever the specified lcore has nothing to do.
89 In the DPDK, if no packet is received after polling,
90 speculative sleeps can be triggered according the strategies defined by the user space application.
91
92 Per-core Turbo Boost
93 --------------------
94
95 Individual cores can be allowed to enter a Turbo Boost state on a per-core
96 basis. This is achieved by enabling Turbo Boost Technology in the BIOS, then
97 looping through the relevant cores and enabling/disabling Turbo Boost on each
98 core.
99
100 API Overview of the Power Library
101 ---------------------------------
102
103 The main methods exported by power library are for CPU frequency scaling and include the following:
104
105 *   **Freq up**: Prompt the kernel to scale up the frequency of the specific lcore.
106
107 *   **Freq down**: Prompt the kernel to scale down the frequency of the specific lcore.
108
109 *   **Freq max**: Prompt the kernel to scale up the frequency of the specific lcore to the maximum.
110
111 *   **Freq min**: Prompt the kernel to scale down the frequency of the specific lcore to the minimum.
112
113 *   **Get available freqs**: Read the available frequencies of the specific lcore from the sys file.
114
115 *   **Freq get**: Get the current frequency of the specific lcore.
116
117 *   **Freq set**: Prompt the kernel to set the frequency for the specific lcore.
118
119 *   **Enable turbo**: Prompt the kernel to enable Turbo Boost for the specific lcore.
120
121 *   **Disable turbo**: Prompt the kernel to disable Turbo Boost for the specific lcore.
122
123 User Cases
124 ----------
125
126 The power management mechanism is used to save power when performing L3 forwarding.
127
128 References
129 ----------
130
131 *   l3fwd-power: The sample application in DPDK that performs L3 forwarding with power management.
132
133 *   The "L3 Forwarding with Power Management Sample Application" chapter in the *DPDK Sample Application's User Guide*.