xref: /dpdk/doc/guides/prog_guide/power_man.rst (revision 5630257fcc30397e7217139ec55da4f301f59fb7)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2010-2014 Intel Corporation.
3
4Power Management
5================
6
7The DPDK Power Management feature allows users space applications to save power
8by dynamically adjusting CPU frequency or entering into different C-States.
9
10*   Adjusting the CPU frequency dynamically according to the utilization of RX queue.
11
12*   Entering into different deeper C-States according to the adaptive algorithms to speculate
13    brief periods of time suspending the application if no packets are received.
14
15The interfaces for adjusting the operating CPU frequency are in the power management library.
16C-State control is implemented in applications according to the different use cases.
17
18CPU Frequency Scaling
19---------------------
20
21The Linux kernel provides a cpufreq module for CPU frequency scaling for each lcore.
22For example, for cpuX, /sys/devices/system/cpu/cpuX/cpufreq/ has the following sys files for frequency scaling:
23
24*   affected_cpus
25
26*   bios_limit
27
28*   cpuinfo_cur_freq
29
30*   cpuinfo_max_freq
31
32*   cpuinfo_min_freq
33
34*   cpuinfo_transition_latency
35
36*   related_cpus
37
38*   scaling_available_frequencies
39
40*   scaling_available_governors
41
42*   scaling_cur_freq
43
44*   scaling_driver
45
46*   scaling_governor
47
48*   scaling_max_freq
49
50*   scaling_min_freq
51
52*   scaling_setspeed
53
54In the DPDK, scaling_governor is configured in user space.
55Then, a user space application can prompt the kernel by writing scaling_setspeed to adjust the CPU frequency
56according to the strategies defined by the user space application.
57
58Core-load Throttling through C-States
59-------------------------------------
60
61Core state can be altered by speculative sleeps whenever the specified lcore has nothing to do.
62In the DPDK, if no packet is received after polling,
63speculative sleeps can be triggered according the strategies defined by the user space application.
64
65Per-core Turbo Boost
66--------------------
67
68Individual cores can be allowed to enter a Turbo Boost state on a per-core
69basis. This is achieved by enabling Turbo Boost Technology in the BIOS, then
70looping through the relevant cores and enabling/disabling Turbo Boost on each
71core.
72
73Use of Power Library in a Hyper-Threaded Environment
74----------------------------------------------------
75
76In the case where the power library is in use on a system with Hyper-Threading enabled,
77the frequency on the physical core is set to the highest frequency of the Hyper-Thread siblings.
78So even though an application may request a scale down, the core frequency will
79remain at the highest frequency until all Hyper-Threads on that core request a scale down.
80
81API Overview of the Power Library
82---------------------------------
83
84The main methods exported by power library are for CPU frequency scaling and include the following:
85
86*   **Freq up**: Prompt the kernel to scale up the frequency of the specific lcore.
87
88*   **Freq down**: Prompt the kernel to scale down the frequency of the specific lcore.
89
90*   **Freq max**: Prompt the kernel to scale up the frequency of the specific lcore to the maximum.
91
92*   **Freq min**: Prompt the kernel to scale down the frequency of the specific lcore to the minimum.
93
94*   **Get available freqs**: Read the available frequencies of the specific lcore from the sys file.
95
96*   **Freq get**: Get the current frequency of the specific lcore.
97
98*   **Freq set**: Prompt the kernel to set the frequency for the specific lcore.
99
100*   **Enable turbo**: Prompt the kernel to enable Turbo Boost for the specific lcore.
101
102*   **Disable turbo**: Prompt the kernel to disable Turbo Boost for the specific lcore.
103
104User Cases
105----------
106
107The power management mechanism is used to save power when performing L3 forwarding.
108
109References
110----------
111
112*   l3fwd-power: The sample application in DPDK that performs L3 forwarding with power management.
113
114*   The "L3 Forwarding with Power Management Sample Application" chapter in the *DPDK Sample Application's User Guide*.
115