1fc1f2750SBernard Iremonger.. BSD LICENSE 2fc1f2750SBernard Iremonger Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 3fc1f2750SBernard Iremonger All rights reserved. 4fc1f2750SBernard Iremonger 5fc1f2750SBernard Iremonger Redistribution and use in source and binary forms, with or without 6fc1f2750SBernard Iremonger modification, are permitted provided that the following conditions 7fc1f2750SBernard Iremonger are met: 8fc1f2750SBernard Iremonger 9fc1f2750SBernard Iremonger * Redistributions of source code must retain the above copyright 10fc1f2750SBernard Iremonger notice, this list of conditions and the following disclaimer. 11fc1f2750SBernard Iremonger * Redistributions in binary form must reproduce the above copyright 12fc1f2750SBernard Iremonger notice, this list of conditions and the following disclaimer in 13fc1f2750SBernard Iremonger the documentation and/or other materials provided with the 14fc1f2750SBernard Iremonger distribution. 15fc1f2750SBernard Iremonger * Neither the name of Intel Corporation nor the names of its 16fc1f2750SBernard Iremonger contributors may be used to endorse or promote products derived 17fc1f2750SBernard Iremonger from this software without specific prior written permission. 18fc1f2750SBernard Iremonger 19fc1f2750SBernard Iremonger THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20fc1f2750SBernard Iremonger "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21fc1f2750SBernard Iremonger LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22fc1f2750SBernard Iremonger A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23fc1f2750SBernard Iremonger OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24fc1f2750SBernard Iremonger SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25fc1f2750SBernard Iremonger LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26fc1f2750SBernard Iremonger DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27fc1f2750SBernard Iremonger THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28fc1f2750SBernard Iremonger (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29fc1f2750SBernard Iremonger OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30fc1f2750SBernard Iremonger 31fc1f2750SBernard IremongerPower Management 32fc1f2750SBernard Iremonger================ 33fc1f2750SBernard Iremonger 34*48624fd9SSiobhan ButlerThe DPDK Power Management feature allows users space applications to save power 35fc1f2750SBernard Iremongerby dynamically adjusting CPU frequency or entering into different C-States. 36fc1f2750SBernard Iremonger 37fc1f2750SBernard Iremonger* Adjusting the CPU frequency dynamically according to the utilization of RX queue. 38fc1f2750SBernard Iremonger 39fc1f2750SBernard Iremonger* Entering into different deeper C-States according to the adaptive algorithms to speculate 40fc1f2750SBernard Iremonger brief periods of time suspending the application if no packets are received. 41fc1f2750SBernard Iremonger 42fc1f2750SBernard IremongerThe interfaces for adjusting the operating CPU frequency are in the power management library. 43fc1f2750SBernard IremongerC-State control is implemented in applications according to the different use cases. 44fc1f2750SBernard Iremonger 45fc1f2750SBernard IremongerCPU Frequency Scaling 46fc1f2750SBernard Iremonger--------------------- 47fc1f2750SBernard Iremonger 48fc1f2750SBernard IremongerThe Linux kernel provides a cpufreq module for CPU frequency scaling for each lcore. 49fc1f2750SBernard IremongerFor example, for cpuX, /sys/devices/system/cpu/cpuX/cpufreq/ has the following sys files for frequency scaling: 50fc1f2750SBernard Iremonger 51fc1f2750SBernard Iremonger* affected_cpus 52fc1f2750SBernard Iremonger 53fc1f2750SBernard Iremonger* bios_limit 54fc1f2750SBernard Iremonger 55fc1f2750SBernard Iremonger* cpuinfo_cur_freq 56fc1f2750SBernard Iremonger 57fc1f2750SBernard Iremonger* cpuinfo_max_freq 58fc1f2750SBernard Iremonger 59fc1f2750SBernard Iremonger* cpuinfo_min_freq 60fc1f2750SBernard Iremonger 61fc1f2750SBernard Iremonger* cpuinfo_transition_latency 62fc1f2750SBernard Iremonger 63fc1f2750SBernard Iremonger* related_cpus 64fc1f2750SBernard Iremonger 65fc1f2750SBernard Iremonger* scaling_available_frequencies 66fc1f2750SBernard Iremonger 67fc1f2750SBernard Iremonger* scaling_available_governors 68fc1f2750SBernard Iremonger 69fc1f2750SBernard Iremonger* scaling_cur_freq 70fc1f2750SBernard Iremonger 71fc1f2750SBernard Iremonger* scaling_driver 72fc1f2750SBernard Iremonger 73fc1f2750SBernard Iremonger* scaling_governor 74fc1f2750SBernard Iremonger 75fc1f2750SBernard Iremonger* scaling_max_freq 76fc1f2750SBernard Iremonger 77fc1f2750SBernard Iremonger* scaling_min_freq 78fc1f2750SBernard Iremonger 79fc1f2750SBernard Iremonger* scaling_setspeed 80fc1f2750SBernard Iremonger 81*48624fd9SSiobhan ButlerIn the DPDK, scaling_governor is configured in user space. 82fc1f2750SBernard IremongerThen, a user space application can prompt the kernel by writing scaling_setspeed to adjust the CPU frequency 83fc1f2750SBernard Iremongeraccording to the strategies defined by the user space application. 84fc1f2750SBernard Iremonger 85fc1f2750SBernard IremongerCore-load Throttling through C-States 86fc1f2750SBernard Iremonger------------------------------------- 87fc1f2750SBernard Iremonger 88fc1f2750SBernard IremongerCore state can be altered by speculative sleeps whenever the specified lcore has nothing to do. 89*48624fd9SSiobhan ButlerIn the DPDK, if no packet is received after polling, 90fc1f2750SBernard Iremongerspeculative sleeps can be triggered according the strategies defined by the user space application. 91fc1f2750SBernard Iremonger 92fc1f2750SBernard IremongerAPI Overview of the Power Library 93fc1f2750SBernard Iremonger--------------------------------- 94fc1f2750SBernard Iremonger 95fc1f2750SBernard IremongerThe main methods exported by power library are for CPU frequency scaling and include the following: 96fc1f2750SBernard Iremonger 97fc1f2750SBernard Iremonger* **Freq up**: Prompt the kernel to scale up the frequency of the specific lcore. 98fc1f2750SBernard Iremonger 99fc1f2750SBernard Iremonger* **Freq down**: Prompt the kernel to scale down the frequency of the specific lcore. 100fc1f2750SBernard Iremonger 101fc1f2750SBernard Iremonger* **Freq max**: Prompt the kernel to scale up the frequency of the specific lcore to the maximum. 102fc1f2750SBernard Iremonger 103fc1f2750SBernard Iremonger* **Freq min**: Prompt the kernel to scale down the frequency of the specific lcore to the minimum. 104fc1f2750SBernard Iremonger 105fc1f2750SBernard Iremonger* **Get available freqs**: Read the available frequencies of the specific lcore from the sys file. 106fc1f2750SBernard Iremonger 107fc1f2750SBernard Iremonger* **Freq get**: Get the current frequency of the specific lcore. 108fc1f2750SBernard Iremonger 109fc1f2750SBernard Iremonger* **Freq set**: Prompt the kernel to set the frequency for the specific lcore. 110fc1f2750SBernard Iremonger 111fc1f2750SBernard IremongerUser Cases 112fc1f2750SBernard Iremonger---------- 113fc1f2750SBernard Iremonger 114fc1f2750SBernard IremongerThe power management mechanism is used to save power when performing L3 forwarding. 115fc1f2750SBernard Iremonger 116fc1f2750SBernard IremongerReferences 117fc1f2750SBernard Iremonger---------- 118fc1f2750SBernard Iremonger 119*48624fd9SSiobhan Butler* l3fwd-power: The sample application in DPDK that performs L3 forwarding with power management. 120fc1f2750SBernard Iremonger 121*48624fd9SSiobhan Butler* The "L3 Forwarding with Power Management Sample Application" chapter in the *DPDK Sample Application's User Guide*. 122