Skip to content

Commit 8e9ccd0

Browse files
committed
Merge tag 'pm-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "Restore an optimization related to asynchronous suspend and resume of devices during system-wide power transitions that was disabled by mistake (Kai-Heng Feng) and update the pm-graph suite of power management utilities (Todd Brandt)" * tag 'pm-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM: sleep: core: Switch back to async_schedule_dev() pm-graph v5.6
2 parents 5be35f7 + 4bee16d commit 8e9ccd0

File tree

6 files changed

+620
-372
lines changed

6 files changed

+620
-372
lines changed

drivers/base/power/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ static bool dpm_async_fn(struct device *dev, async_func_t func)
730730

731731
if (is_async(dev)) {
732732
get_device(dev);
733-
async_schedule(func, dev);
733+
async_schedule_dev(func, dev);
734734
return true;
735735
}
736736

tools/power/pm-graph/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ uninstall :
4141
if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config ] ; then \
4242
rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/config; \
4343
fi;
44+
rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__/*
45+
if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__ ] ; then \
46+
rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__; \
47+
fi;
4448
rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/*
4549
if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph ] ; then \
4650
rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph; \

tools/power/pm-graph/README

Lines changed: 114 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
p m - g r a p h
1+
_
2+
_ __ _ __ ___ __ _ _ __ __ _ _ __ | |__
3+
| '_ \| '_ ` _ \ _____ / _` | '__/ _` | '_ \| '_ \
4+
| |_) | | | | | |_____| (_| | | | (_| | |_) | | | |
5+
| .__/|_| |_| |_| \__, |_| \__,_| .__/|_| |_|
6+
|_| |___/ |_|
27

38
pm-graph: suspend/resume/boot timing analysis tools
4-
Version: 5.5
9+
Version: 5.6
510
Author: Todd Brandt <[email protected]>
611
Home Page: https://01.org/pm-graph
712

@@ -18,17 +23,15 @@
1823
- upstream version in git:
1924
https://github.com/intel/pm-graph/
2025

21-
Requirements:
22-
- runs with python2 or python3, choice is made by /usr/bin/python link
23-
- python2 now requires python-configparser be installed
24-
2526
Table of Contents
2627
- Overview
2728
- Setup
2829
- Usage
2930
- Basic Usage
3031
- Dev Mode Usage
3132
- Proc Mode Usage
33+
- Endurance Testing
34+
- Usage Examples
3235
- Configuration Files
3336
- Usage Examples
3437
- Config File Options
@@ -54,15 +57,18 @@
5457
| SETUP |
5558
------------------------------------------------------------------
5659

57-
These packages are required to execute the scripts
60+
Package Requirements
61+
- runs with python2 or python3, choice is made by /usr/bin/python link
5862
- python
59-
- python-requests
63+
- python-configparser (for python2 sleepgraph)
64+
- python-requests (for googlesheet.py)
65+
- linux-tools-common (for turbostat usage in sleepgraph)
6066

6167
Ubuntu:
62-
sudo apt-get install python python-requests
68+
sudo apt-get install python python-configparser python-requests linux-tools-common
6369

6470
Fedora:
65-
sudo dnf install python python-requests
71+
sudo dnf install python python-configparser python-requests linux-tools-common
6672

6773
The tools can most easily be installed via git clone and make install
6874

@@ -190,6 +196,104 @@ _______________
190196

191197
%> sudo ./sleepgraph.py -config config/suspend-proc.cfg
192198

199+
------------------------------------------------------------------
200+
| ENDURANCE TESTING |
201+
------------------------------------------------------------------
202+
203+
The best way to gauge the health of a system is to run a series of
204+
suspend/resumes over an extended period and analyze the behavior. This can be
205+
accomplished with sleepgraph's -multi argument. You specify two numbers: the
206+
number of tests to run OR the duration in days, hours, or minutes, and the
207+
delay in seconds between them. For instance, -multi 20 5: execute 20 tests with
208+
a 5 second delay between each, or -multi 24h 0: execute tests over a 24 hour
209+
period with no delay between tests. You can include any other options you like
210+
to generate the data you want. It's most useful to collect dev mode timelines
211+
as the kprobes don't alter the performance much and you get more insight.
212+
213+
On completion, the output folder contains a series of folders for the
214+
individual test data and a set of summary pages in the root. The summary.html
215+
file is a tabular list of the tests with relevant info and links. The
216+
summary-issue.html and summary-devices.html files include data taken from
217+
all tests on kernel issues and device performance. The folder looks like this:
218+
219+
suspend-xN-{date}-{time}:
220+
summary.html
221+
summary-issues.html
222+
summary-devices.html
223+
suspend-{date}-{time} (1)
224+
suspend-{date}-{time} (2)
225+
...
226+
227+
These are the relevant arguments to use for testing:
228+
229+
-m mode
230+
Mode to initiate for suspend e.g. mem, freeze, standby (default: mem).
231+
232+
-rtcwake t
233+
Use rtcwake to autoresume after t seconds (default: 15).
234+
235+
-gzip (optional)
236+
Gzip the trace and dmesg logs to save space. The tool can also read in
237+
gzipped logs for processing. This reduces the multitest folder size.
238+
239+
-dev (optional)
240+
Add kernel source calls and threads to the timeline (default: disabled).
241+
242+
-multi n d
243+
Execute n consecutive tests at d seconds intervals. The outputs will be
244+
created in a new subdirectory: suspend-xN-{date}-{time}. When the multitest
245+
run is done, the -summary command is called automatically to create summary
246+
html files for all the data (unless you use -skiphtml). -skiphtml will
247+
speed up the testing by not creating timelines or summary html files. You
248+
can then run the tool again at a later time with -summary and -genhtml to
249+
create the timelines.
250+
251+
-skiphtml (optional)
252+
Run the test and capture the trace logs, but skip the timeline and summary
253+
html generation. This can greatly speed up overall testing. You can then
254+
copy the data to a faster host machine and run -summary -genhtml to
255+
generate the timelines and summary.
256+
257+
These are the relevant commands to use after testing is complete:
258+
259+
-summary indir
260+
Generate or regenerate the summary for a -multi test run. Creates three
261+
files: summary.html, summary-issues.html, and summary-devices.html in the
262+
current folder. summary.html is a table of tests with relevant info sorted
263+
by kernel/host/mode, and links to the test html files. summary-issues.html
264+
is a list of kernel issues found in dmesg from all the tests.
265+
summary-devices.html is a list of devices and times from all the tests.
266+
267+
-genhtml
268+
Used with -summary to regenerate any missing html timelines from their
269+
dmesg and ftrace logs. This will require a significant amount of time if
270+
there are thousands of tests.
271+
272+
Usage Examples
273+
_______________
274+
275+
A multitest is initiated like this:
276+
277+
%> sudo ./sleepgraph.py -m mem -rtcwake 10 -dev -gzip -multi 2000 0
278+
279+
or you can skip timeline generation in order to speed things up
280+
281+
%> sudo ./sleepgraph.py -m mem -rtcwake 10 -dev -gzip -multi 2000 0 -skiphtml
282+
283+
The tool will produce an output folder with all the test subfolders inside.
284+
Each test subfolder contains the dmesg/ftrace logs and/or the html timeline
285+
depending on whether you used the -skiphtml option. The root folder contains
286+
the summary.html files.
287+
288+
The summary for an existing multitest is generated like this:
289+
290+
%> cd suspend-x2000-{date}-{time}
291+
%> sleepgraph.py -summary .
292+
293+
or if you need to generate the html timelines you can use -genhtml
294+
295+
%> cd suspend-xN-{date}-{time}
296+
%> sleepgraph.py -summary . -genhtml
193297

194298
------------------------------------------------------------------
195299
| CONFIGURATION FILES |

tools/power/pm-graph/bootgraph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python3
22
# SPDX-License-Identifier: GPL-2.0-only
33
#
44
# Tool for analyzing boot timing

tools/power/pm-graph/sleepgraph.8

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ after the test is complete.
7474
Switch the display to the requested mode for the test using the xset command.
7575
This helps maintain the consistency of test data for better comparison.
7676
.TP
77-
\fB-skiphtml\fR
78-
Run the test and capture the trace logs, but skip the timeline generation.
77+
\fB-wifi\fR
78+
If a wifi connection is available, check that it reconnects after resume. Include
79+
the reconnect time in the total resume time calculation and treat wifi timeouts
80+
as resume failures.
7981

8082
.SS "advanced"
8183
.TP
@@ -117,8 +119,24 @@ Include \fIt\fR ms delay before 1st suspend (default: 0 ms).
117119
Include \fIt\fR ms delay after last resume (default: 0 ms).
118120
.TP
119121
\fB-multi \fIn d\fR
120-
Execute \fIn\fR consecutive tests at \fId\fR seconds intervals. The outputs will
121-
be created in a new subdirectory with a summary page: suspend-xN-{date}-{time}.
122+
Used for endurance testing. If \fIn\fR is entirely numeric, it's treated as a count:
123+
Execute \fIn\fR consecutive tests at \fId\fR second intervals.
124+
If \fIn\fR is an integer followed by a "d", "h", or "m", it's treated as a duration:
125+
Execute tests continuously over \fIn\fR days, hours, or minutes at \fId\fR second intervals.
126+
The outputs will be created in a new subdirectory, for count: suspend-{date}-{time}-xN,
127+
for duration: suspend-{date}-{time}-Nm. When the multitest run is done, the \fI-summary\fR
128+
command is called automatically to create summary html files for all the data (unless you
129+
use \fI-skiphtml\fR). \fI-skiphtml\fR will speed up the testing by not creating timelines
130+
or summary html files. You can then run the tool again at a later time with \fI-summary\fR
131+
and \fI-genhtml\fR to create the timelines.
132+
.TP
133+
\fB-maxfail \fIn\fR
134+
Abort a -multi run after \fIn\fR consecutive fails. 0 means never abort (default = 0).
135+
.TP
136+
\fB-skiphtml\fR
137+
Run the test and capture the trace logs, but skip the timeline generation.
138+
You can generate the html timelines later with \fI-dmesg\fR & \fI-ftrace\fR, or
139+
by running \fI-summary\fR and \fI-genhtml\fR.
122140

123141
.SS "ftrace debug"
124142
.TP
@@ -173,11 +191,20 @@ Set trace buffer size to N kilo-bytes (default: all of free memory up to 3GB)
173191
.SH COMMANDS
174192
.TP
175193
\fB-summary \fIindir\fR
176-
Create a summary page of all tests in \fIindir\fR. Creates summary.html
177-
in the current folder. The output page is a table of tests with
178-
suspend and resume values sorted by suspend mode, host, and kernel.
179-
Includes test averages by mode and links to the test html files.
180-
Use -genhtml to include tests with missing html.
194+
Create a set of summary pages for all tests in \fIindir\fR recursively.
195+
Creates summary.html, summary-issues.html, and summary-devices.html in the current folder.
196+
summary.html is a table of tests with relevant info sorted by kernel/host/mode,
197+
and links to the test html files. It identifies the minimum, maximum, and median
198+
suspend and resume times for you with highlights and links in the header.
199+
summary-issues.html is a list of kernel issues found in dmesg from all the tests.
200+
summary-devices.html is a list of devices and times from all the tests.
201+
202+
Use \fI-genhtml\fR to regenerate any tests with missing html.
203+
.TP
204+
\fB-genhtml\fR
205+
Used with \fI-summary\fR to regenerate any missing html timelines from their
206+
dmesg and ftrace logs. This will require a significant amount of time if there
207+
are thousands of tests.
181208
.TP
182209
\fB-modes\fR
183210
List available suspend modes.
@@ -189,10 +216,7 @@ with any options you intend to use to see if they will work.
189216
\fB-fpdt\fR
190217
Print out the contents of the ACPI Firmware Performance Data Table.
191218
.TP
192-
\fB-battery\fR
193-
Print out battery status and current charge.
194-
.TP
195-
\fB-wifi\fR
219+
\fB-wificheck\fR
196220
Print out wifi status and connection details.
197221
.TP
198222
\fB-xon/-xoff/-xstandby/-xsuspend\fR
@@ -208,6 +232,9 @@ Print out system info extracted from BIOS. Reads /dev/mem directly instead of go
208232
\fB-devinfo\fR
209233
Print out the pm settings of all devices which support runtime suspend.
210234
.TP
235+
\fB-cmdinfo\fR
236+
Print out all the platform data collected from the system that makes it into the logs.
237+
.TP
211238
\fB-flist\fR
212239
Print the list of ftrace functions currently being captured. Functions
213240
that are not available as symbols in the current kernel are shown in red.
@@ -272,14 +299,20 @@ Run two suspends back to back, include a 500ms delay before, after, and in betwe
272299
.IP
273300
\f(CW$ sudo sleepgraph -m mem -rtcwake 15 -x2 -predelay 500 -x2delay 500 -postdelay 500\fR
274301
.PP
302+
Execute a suspend using a custom command.
303+
.IP
304+
\f(CW$ sudo sleepgraph -cmd "echo mem > /sys/power/state" -rtcwake 15\fR
305+
.PP
306+
307+
.SS "endurance testing using -multi"
308+
.PP
275309
Do a batch run of 10 freezes with 30 seconds delay between runs.
276310
.IP
277311
\f(CW$ sudo sleepgraph -m freeze -rtcwake 15 -multi 10 30\fR
278312
.PP
279-
Execute a suspend using a custom command.
313+
Do a batch run of freezes for 24 hours.
280314
.IP
281-
\f(CW$ sudo sleepgraph -cmd "echo mem > /sys/power/state" -rtcwake 15\fR
282-
.PP
315+
\f(CW$ sudo sleepgraph -m freeze -rtcwake 15 -multi 24h 0\fR
283316

284317
.SS "adding callgraph data"
285318
Add device callgraphs. Limit the trace depth and only show callgraphs 10ms or larger.

0 commit comments

Comments
 (0)