Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ons4
1 'ather slow and difficult to use
6
.tre## te#ting
7cripts that do some PM related operations in a tight loop
1 89ample4 suspend loop with a wa$eup from suspend e!ery :;;ms
ons4
1 Difficult to figure out what operations to actually e9ecute in the stress testing
script
<
"racing /print& ) low level 012"3
Populate enough debug print$s to the code being e9amined
.f possible2 can also dedicate a custom interface for debug traces
Pros4
1 8asy / #uic$ to use
ons4
1 Typically alters code e9ecution time =especially if using serial port>2 and may
hide the actual problem
1 -ot usable from !ery low le!el code =print$>
1 Print$4s are cached and may not be printed out before a crash happens =e"g"
during suspend>
?
4+*5 ) LED trace
)dd control to some /P., / @8D signal from certain points in code
1 89ample4 @8D is turned on when PU is running2 disabled when idle
Pros4
1 &ell2 debugger is always a debugger
ons4
1 ommunication with PU is probably bloc$ed during low power operating
modes
:;
Buffered trace# ) #tati#tic#
Trace information collected from $ernel side into a ring buffer
Dumped out with a console operation through e"g" debugfs
Typical uses4 cpuidle tracing2 power state usage statistics
Kernel tracepoints seem to be a good tool for this2 and it is easy to add
new tracepoints in case something is missing
Pros4
1 Minor impact to e9ecution times =no slow (& components accessed>
ons4
1 ,nly useful in debugging misbeha!ior =crash pre!ents later dump>
::
Example6 tracepoint# wit- idle !)2
89ecute following script in target de!ice4
D3/bin/sh
traceCcmd reset
sleep :;
traceCcmd start Ce power
sleep :;
traceCcmd stop
traceCcmd e9tract
:2
Example6 tracepoint# wit- idle 2)2
opy resulting trace"dat o!er to host and process it with $ernelshar$
:3
Exporting debug functionalit7 to
u#er#pace
Pro!ide a testing )P. to userspace to read / write hardware registers
directly =on memory mapped registers can use /de!/mem>
8nhance e9isting debug interfaces by adding write functionality in addition
to e9isting readConly )P.s
1 89ample4 regulator fw micro!olt nodes
)dd completely new interfaces where nothing e9ists currently
Pros4
1 (a!ing as much of the functionality a!ailable to userspace as possible ma$es
it easy to write test scripts
1 an dynamically create new test cases
ons4
1 Might not be possible to upstream these
:*
Kernel +, feature#
:+
.u#pend
89ecuted from command line =echo mem E /sys/power/state>
Disables all dri!ers manually
1 Disables also trace3
Tools for debugging4
1 Trace =limited>
1 /pios
1 Debugger =with brea$points>
Tric$s4
1 Pre!ent low le!el PM entry so that hardware is mostly ta$en out from debug
process2 reCenable once 7& wor$s
:6
Cpuidle
Fit complicated as can e9ecute multiple different states based on
system status
Tools for debugging4
1 Traces =limited> / gpios / ring buffer
1 Debugger can be used with brea$points
Debug information from userspace4
1 /sys/de!ices/system/cpu/G/cpuidle/G
Tric$s4
1 89port )P. to userspace to HforceI a certain state always
:<
2egulator#
Userspace )P. a!ailable at /sys/class/regulator
8asy to chec$ the status of regulator framewor$ against hardware
status by using multimeter etc"
Tric$s4
1 89port write capability for micro!olt nodes to userspace
1 89port regulator enable / disable to userspace
:?
Cloc& framewor&
,ngoing wor$ within @inaro to get a common cloc$ framewor$ into the
$ernel
Part of the code e9ists already but integration missing to most of the
platforms
Userspace interface4
1 /sys/$ernel/debug/cl$/G
1 Pro!ides info for cloc$ rates2 usecounts2 flags etc"
1 8asy to twea$ to allow manual enable of cloc$s from userspace
:B
Cpufre8
Pretty easy to debug2 as typically does not bloc$ any $ernel
functionality2 and has nice )P.s readily a!ailable from userspace
an usually trace through e!erything
1 May ha!e a critical section that re#uires more comple9 debugging
Debug information from userspace4
1 /sys/de!ices/system/cpu/G/cpufre#/G
1 /sys/class/regulator/G
1 /sys/$ernel/debug/cl$/G if a!ailable
Tric$s4
1 7elect cloc$ fre#uency manually with 5ondemand5 go!ernor by writing to
5scaling0min/ma90fre#5 nodes
2;
Devfre8
De!ice specific DJ%72 relati!ely similar to cpufre#
7hould also be possible to trace through e!erything
)dds e9tra 5de!fre#5 directory under de!ice sysfs node
2:
"7pical +, problem#
22
Bootloader madne## in#anit7
8!erybody uses a different bootloader
@ots of features inside the bootloaders2 which typically lea!e hardware
enabled after use KE pre!ents PM
hec$ if cpuidle / suspend wor$ properly and set the de!ice to proper
state
1 7ysfs status for cpuidle
1 timer0stats
1 'egulator status
1 &hate!er else is e9ported to userspace from (& point of !iew
/ood if you ha!e a wor$ing / nonCwor$ing case where you can
compare the system state
26
*ncrea#ed power con#umption : -ardware
/2)93
(ardware problems usually force higher power use than planned
1 May need to disable some power sa!ing techni#ues
e"g" some regulator must always be 5enabled5
1 7ome (& pulls are incorrectly designed and consume e9tra power
Might be possible to reduce impact in some cases with software twea$s
1 8"g" align e9ternal pull !s" 7o configurable pull config
May need to reCdesign hardware
2<
*ncrea#ed power con#umption % u#er#pace
/9)93
Typical culprit for consuming too much power
7ome process is using too much resources for e9ecution
1 Pre!ents cpuidle completely =cpu load> or partially =timer usage>
hec$ out 5top5 or something similar for PU load
/proc/timer0stats is good for figuring out timers that are used too often
2?
.ome reference#
Powertop
1 Parses timer N process N interrupt info
1 https4//;:"org/powertop/
Powerdebug
1 Parses regulator N cloc$ framewor$ N sensor data
1 https4//wi$i"linaro"org/&or$ing/roups/PowerManagement/Doc/PowerDebug
Tracepoints
1 Kernel source4 include/trace/e!ents/power"h
1 Debugfs4 /sys/$ernel/debug/tracing/'8)DM8
Parsers4 =target> traceCcmd KE =host> $ernelshar$2 pytimechart
2B
"-an& 7ou;