power capping linux
TRANSCRIPT
![Page 1: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/1.jpg)
Power Capping Linux
Len Brown, Jacob Pan, Srinivas Pandruvada
![Page 2: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/2.jpg)
2
Agenda
• Context
• System Power Management Issues
• Power Capping Overview
• Power capping participants
• Recommendation
• Linux Power Capping Framework RFC
![Page 3: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/3.jpg)
3
Context: Power Planning Issues
• Over budgeting
• Unpredictability of load
![Page 4: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/4.jpg)
4
• Worldwide, the digital warehouses use about 30 billion watts of
electricity
• Equivalent to the output of 30 nuclear power plants
• On average, using only 6 percent to 12 percent of the electricity
powering their servers to perform computations.
• The rest was essentially used to keep servers idling and ready in case
of a surge in activity that could slow or crash their operations.
Source: http://www.nytimes.com/2012/09/23/technology/data-centers-waste-vast-amounts-of-energy-belying-industry-
image.html?pagewanted=all&_r=0
Power over budgeting
![Page 5: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/5.jpg)
5
Unpredictability of battery life
"Many report unpredictable spikes in battery use, and batteries becoming
unnervingly hot, even when used outdoors in the shade."
Read more: http://www.dailymail.co.uk/sciencetech/article-2055562/Apple-iPhone-4S-battery-dies-12-
hours--users-forced-ways-patch-mend.html#ixzz2dJ5L1Uqz
![Page 6: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/6.jpg)
6
System Power Management Issues
• Limited power capacity
• Limited cooling capacity
• Unexpected peaks in system utilization
• Downtime caused by unexpected power surges
• Mobile devices: Unpredictable battery life
• Too many consumers of power
![Page 7: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/7.jpg)
7
Power Capping Overview
• Limit power consumed by devices
• Dynamically adjust to meet power budget
• Redistribution of power among server systems
• Maximize performance
![Page 8: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/8.jpg)
8
Power Capping Participants
• CPUs
• GPUs
• DRAM
• Others
• Multimedia sub system
• Wireless sub system
![Page 9: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/9.jpg)
9
Power Capping CPU/GPUs
• Dynamic P-states adjustment
• Dynamic T-states adjustment
• Processor offline
• Idle injection
• ACPI power meter
• ACPI processor aggregator
![Page 10: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/10.jpg)
10
Power Capping Measurements
• Test Setup
• Intel Ivy Bridge Dual Core Laptop
• Power meter: Yokogawa WT210
• Test load: openssl speed sha256
![Page 11: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/11.jpg)
11
P-States
• P-state: a voltage/frequency pair
• P1 : Guaranteed frequency
• Pn-P1 range in OS control
• P0: Max possible frequency under HW control
Turbo
H/W
Control
OS
controlled
States
P0
P1
Pn
![Page 12: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/12.jpg)
12
Controlling P-states
• Intel P State Driver
• sysfs: max_perf_pct, min_perf_pct, no_turbo
• CPUFREQ
• Sysfs: scaling_max_freq, scaling_min_freq, scaling_setspeed
• Thermal Cooling device
• sysfs: /sys/class/thermal/cooling_device# /type = “Processor”
• RAPL (Running Average Power Limit)
• sysfs: via power capping framework
![Page 13: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/13.jpg)
13
P States Performance (Using Intel P State Driver)
![Page 14: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/14.jpg)
14
RAPL
• Power monitoring capability
• Power Limiting
• Performance feedback mechanism
• Implemented in processor
• Interface via MSR, PCIe config space
![Page 15: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/15.jpg)
15
RAPL Domains and Interfaces
![Page 16: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/16.jpg)
16
RAPL Performance
![Page 17: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/17.jpg)
17
T-States
• Allow Software Controlled Clock modulation
• Controls stop clock duty cycle
• Time period for clock signal to drive processor
• Controlled via thermal cooling device interface for processor
Processor clock
Stop clock duty cycle
Example: 25%
![Page 18: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/18.jpg)
18
T-States Performance
![Page 19: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/19.jpg)
19
Idle Injection
• Implemented by Intel Power Clamp Cooling Driver
• sysfs: /sys/class/thermal/cooling_device# /type = “intel_powerclamp”
• Monitors and enforces idle time for each online CPU
• User selectable idle ratio from 0 to 50%
inactive Force
idle
CPU 0
Kidle_inject/0
CPU 1
Kidle_inject/1 Force
idle inactive
inactive
inactive
![Page 20: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/20.jpg)
20
Idle Injection Performance
![Page 21: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/21.jpg)
21
CPU Offline
• Migrate activity on current CPU to new CPU
• Processes, interrupts, timers
• Logical online/offline CPUs using sysfs interface
• sysfs: /sys/devices/system/cpu/cpu#/online
• Conditional physical offline/online
• depends on BIOS and kernel build flags
• Limited CPU 0 offline
![Page 22: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/22.jpg)
22
CPU Offline Performance
![Page 23: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/23.jpg)
23
ACPI Power Meter
• Expose power meter support defined in ACPI 4.0
• Depends on BIOS support
• Interface to read power over a configurable interval
• Trip point configuration for notification
• Configuration for power capping parameters
• power#_cap_min/power#_cap_max
![Page 24: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/24.jpg)
24
ACPI Processor Aggregator(ACPI_PAD)
• Triggered by ACPI notification only
• Used to resolve short term thermal emergencies
• Not a CPU Offline/online but has similar affect
• Doesn’t affect cupset
• Puts affected CPUs in deep C states
![Page 25: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/25.jpg)
25
ACPI_PAD Vs. CPU Offline
Test platform: Intel Romley 2 socket system
0
50
100
150
200
250
300
350
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
Wat
ts
# cpu Offlined
CPU Offline
acpi_pad
0
10
20
30
40
50
60
70
80
90
100
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
Pe
rf %
# cpu Offlined
CPU Offline
acpi_pad
![Page 26: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/26.jpg)
26
Recommendation
• In order
• RAPL
• P State
• Idle Injection
• CPU Offline
• T States
![Page 27: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/27.jpg)
27
Linux Power Capping Framework
• Interface to set limits on maximum power a system/sub system can
consume, i.e. Power Capping
• Interface to read current power for a system or a sub-system
• Some API which can be used by power capping driver for easy
implementation
• Avoid code duplication if multiple power capping drivers are present
• RFC: http://lwn.net/Articles/562015/
![Page 28: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/28.jpg)
28
Linux Power Capping Framework Class
• Define a Power Capping Class driver interface
• Define API and callbacks to for power capping client drivers
• Present a uniform interface to user space via sysfs
Power cap
class driver
Power cap
client drivers
Registration
Callbacks
sysfs
I/F
![Page 29: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/29.jpg)
29
Power Capping Class driver
• Allow multiple power zones
• Power zone: Independent unit which has capability to measure and enforce power
• Allow parent child relationship among zones
• Exports Sys-FS Interface
• Get Current energy consumption per power zone
• Set Power limit per zone
• Power capping driver interface
![Page 30: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/30.jpg)
30
Power Capping Sys-FS hierarchy example
/sys/class/powercap
intel-rapl control_type n powerclamp
enabled intel-rap:0 intel-rapl:n intel-rapl:1
enabled name energy_uj constraint_X_power_limit_uw constraint_X_name max_energy_range_uj
constraint_X_time_window_us intel_rapl:0:1
![Page 31: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/31.jpg)
31
Power Capping Sys-FS
• Arranged as a tree, with root as a control type
• Control type : Method to implement power capping. E.g. intel-rapl
• A control type contains multiple power zones
• Power zone node names are qualified with the control type, E.g. intel-
rapl:0, intel-rapl:1
• Each power zone can have children as power zones
• Parent child relationship should be based on the relationship of power. E.g.
When child power limit is applied, parent power is also affected
![Page 32: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/32.jpg)
32
Q&A
![Page 33: Power Capping Linux](https://reader034.vdocuments.site/reader034/viewer/2022042421/62605bcaa000f51a8f19b5d0/html5/thumbnails/33.jpg)
Thank You