01 Sep, 2020

1 commit

  • The current notifiers have the following error handling pattern all
    over the place:

    int err, nr;

    err = __foo_notifier_call_chain(&chain, val_up, v, -1, &nr);
    if (err & NOTIFIER_STOP_MASK)
    __foo_notifier_call_chain(&chain, val_down, v, nr-1, NULL)

    And aside from the endless repetition thereof, it is broken. Consider
    blocking notifiers; both calls take and drop the rwsem, this means
    that the notifier list can change in between the two calls, making @nr
    meaningless.

    Fix this by replacing all the __foo_notifier_call_chain() functions
    with foo_notifier_call_chain_robust() that embeds the above pattern,
    but ensures it is inside a single lock region.

    Note: I switched atomic_notifier_call_chain_robust() to use
    the spinlock, since RCU cannot provide the guarantee
    required for the recovery.

    Note: software_resume() error handling was broken afaict.

    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Ingo Molnar
    Acked-by: Rafael J. Wysocki
    Link: https://lore.kernel.org/r/20200818135804.325626653@infradead.org

    Peter Zijlstra
     

27 Jul, 2020

1 commit

  • Important fixes:

    - in s2idle, use timekeeping_freeze trace mark instead of
    machine_suspend to denote entry into s2idle mode.

    - in s2idle, use machine_suspend trace mark to create a new virtual
    device called "s2idle_enter_x". It denotes an s2idle_enter call
    loop of iterations where s2idle was never actually achieved.
    It isn't counted as "freeze time" in the header.

    - in s2idle, only show multiple freeze times if s2idle went in and
    out of resume_noirq. Otherwise multiple freezes are shown with
    "waking" time subtracted (waking time is time spent outside s2idle
    dealing with wakeups).

    - in s2idle summaries, include "FREEZEWAKE" as an issue when at
    least 1ms is spent waking from s2idle. A clean run should only
    wake for the rtc timer.

    - add support for device callbacks with matching names in the same
    phase. In rare cases some devices register multiple callbacks from
    separate drivers using the same name. Without this fix only one is
    shown.

    - add kparamsfmt string back to fix bootgraph

    General updates:

    - when suspend_machine is missing, error says "failed in
    suspend_machine"

    - extract target count/time and add to summary title if -multi
    used

    - include any instances of "timeout" in dmesg as issues to be
    logged.

    - fix ftrace parse to handle any number of flags (instead of
    just 4).

    - remove sync/async_device string from device detail, remains in
    hover.

    - when using callgraph (-f) add driver name to callgraph titles.

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd Brandt
     

02 Jun, 2020

1 commit


07 May, 2020

1 commit

  • The single user could have called freeze_secondary_cpus() directly.

    Since this function was a source of confusion, remove it as it's
    just a pointless wrapper.

    While at it, rename enable_nonboot_cpus() to thaw_secondary_cpus() to
    preserve the naming symmetry.

    Done automatically via:

    git grep -l enable_nonboot_cpus | xargs sed -i 's/enable_nonboot_cpus/thaw_secondary_cpus/g'

    Signed-off-by: Qais Yousef
    Signed-off-by: Thomas Gleixner
    Cc: "Rafael J. Wysocki"
    Link: https://lkml.kernel.org/r/20200430114004.17477-1-qais.yousef@arm.com

    Qais Yousef
     

20 Apr, 2020

1 commit

  • sleepgraph:
    - force usage of python3 instead of using system default
    - fix bugzilla 204773 (https://bugzilla.kernel.org/show_bug.cgi?id=204773)
    - fix issue of platform info not being reset in -multi (logs fill up)
    - change -ftop call to "pm_suspend", this is one level below state_store
    - add -wificheck command to read out the current wifi device details
    - change -wifi behavior to poll /proc/net/wireless for wifi connect
    - add wifi reconnect time to timeline, include time in summary column
    - add "fail on wifi_resume" to timeline and summary when wifi fails
    - add a set of commands to collect data before/after suspend in the log
    - add "-cmdinfo" command which prints out all the data collected
    - check for cmd info tools at start, print found/missing in green/red
    - fix kernel suspend time calculation: tool used to look for start of
    pm_suspend_console, but the order has changed. latest kernel starts
    with ksys_sync, use this instead
    - include time spent in mem/disk in the header (same as freeze/standby)
    - ignore turbostat 32-bit capability warnings
    - print to result.txt when -skiphtml is used, just say result: pass
    - don't exit on SIGTSTP, it's a ctrl-Z and the tool may come back
    - -multi argument supports duration as well as count: hours, minutes, seconds
    - update the -multi status output to be more informative
    - -maxfail sets maximum consecutive fails before a -multi run is aborted
    - in -summary, ignore dmesg/ftrace/html files that are 0 size

    bootgraph:
    - force usage of python3 instead of using system default

    README:
    - add endurance testing instructions

    Makefile:
    - remove pycache on uninstall

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd Brandt
     

05 Sep, 2019

1 commit


21 Aug, 2019

1 commit

  • Upgrade bootgraph/sleepgraph to be able to run on python2 and python3.
    Both now simply require python, the system can choose which to use.

    bootgraph python3 update:
    - add floor function to handle integer arithmetic
    - change argument loop to use next() instead of args.next()
    - open dmesg log and popen in binary, use decode(ascii, ignore)
    - sort all html data to allow diff between python versions
    - change exception handler to use python3 as instead of comma

    sleepgraph python3 update:
    - import configparser not ConfigParser (p2 needs python-configparser)
    - add floor function to handle integer arithmetic
    - change argument loop to use next() instead of args.next()
    - handle popen output in binary, use decode(ascii, ignore)
    - sort all html/output data to allow diff between python versions
    - force gzip open to use text mode, same for file open
    - ensure no binary data is written to logs (ascii convert devprops info)
    - use codecs library to handle zlib encoding for mcelog data
    - remove all uses of python3.7 keyword "async" as members or vars
    - assume all FPDT and DMI data is in binary string form

    sleepgraph:
    - turbostat will be used by default if it's found & the mode is freeze
    - a new option "-noturbostat" will disable its use
    - fix bug where two callgraphs with the same start time overwrite.
    - fix s2idle processing where two suspend/resume_machines occur back2back
    - update getexec function to use which first (assuming PATH exists)
    - new platforminfo data in log with: lspci, gpe counts, /proc/interrupts
    - new data is zipped, b64 encoded, and tacked on the end of ftrace

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd Brandt
     

13 Jun, 2019

1 commit


05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms and conditions of the gnu general public license
    version 2 as published by the free software foundation this program
    is distributed in the hope it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 263 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

27 May, 2019

3 commits

  • Config/man page/README files:
    - include README in the pm-graph folder
    - add more detail to the example config to describe more options
    - update the sleepgraph man page to document the new arguments

    Signed-off-by: Todd Brandt
    [ rjw: Subject ]
    Signed-off-by: Rafael J. Wysocki

    Todd Brandt
     
  • bootgraph:
    - dmesg log format has changed, update parser in two places
    - fix prints in preparation for upgrade to python3

    sleepgraph:
    - fix prints in preparation for upgrade to python3
    - add new trace events and kprobes to cover freeze more completely
    - add new -ftop callgraph trace over suspend_devices_and_enter
    - add -wifi option to check if a wifi connection is active
    - add -skipkprobe option to suppress unwanted kprobes in dev mode
    - add kernel params and sysinfo to the log output
    - don't crash if /dev/mem is throwing IO errors, ignore FPDT and DMI
    - fix kprobe length calculation when calls are recursive
    - add several new kernel issue definitions for USB, ACPI, ATA, etc
    - enable turbostat output to be read from stdout instead of from file
    - add BIOS call data to the timeline from acpi_ps_execute_method kprobe

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd Brandt
     
  • sleepgraph:
    - add support for parsing kernel issues from timeline dmesg logs
    - with -summary, generate a summary-issues.html for kernel issues found
    - with -summary, generate a summary-devices.html for device callback times
    - when recreating a timeline, use -o to set the output html filename
    - capture mcelog data when hardware errors occur and store in log
    - add -turbostat option to capture power data during freeze

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd Brandt
     

09 Oct, 2018

2 commits

  • bootgraph & sleepgraph:
    - funnel all prints through the pprint function
    - remove superfluous print calls, arrange them in single blocks
    - flush stdout on every print, enables log capture on hang

    sleepgraph:
    - in -summary, if all tests have the same host+kernel+mode, add to title
    - update verbose device detail print to include machine suspend/resume
    - match tKernSus and tKernRes to pm_prepare/restore_console
    - fully support multiple suspend/resumes in a single timeline
    - enable various disk modes (disk-suspend, disk-test_resume, etc)
    - add warnings when -display (xset) fails

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd Brandt
     
  • general:
    - add battery charge data before and after test
    - remove special s0i3 handling
    - remove melding of dmesg & ftrace data in old kernels, use one only
    - updates to various kprobes in trace (ksys_sync, etc)
    - enable pm_debug_messages during the test
    - instrument more subsystems with dev functions (phy0)

    error handling:
    - return codes for tool show the status of the test run
    - 0: success, 1: general error (no timeline), 2: fail (suspend aborted)
    - monitor output of /sys/power/state, mark as failure if exception occurs
    - add signal handler when using -result to catch tool exceptions

    display control
    - add -x commands for testing xset with mode settings and status
    - allow display setting to on, off, suspend, standby
    - add display mode change info to the log, along with a warning on fail

    s2idle (freeze)
    - remove fixed 10-phase dependency, allow any phase order & any count
    - multiple phase occurences show as phase_nameN e.g. suspend_noirq3
    - if multiple freezes occur, print multiple time values in header

    summary:
    - add new columns to summary output: issues, worst suspend/resume devices
    - worst device: includes summation of all phases of suspend or resume
    - issues: includes WARNING/ERROR/BUG from dmesg log, and other issues
    - s2idle: multiple freezes show as FREEZExN in the issues column

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd Brandt
     

16 Jun, 2018

1 commit

  • As we move stuff around, some doc references are broken. Fix some of
    them via this script:
    ./scripts/documentation-file-ref-check --fix

    Manually checked if the produced result is valid, removing a few
    false-positives.

    Acked-by: Takashi Iwai
    Acked-by: Masami Hiramatsu
    Acked-by: Stephen Boyd
    Acked-by: Charles Keepax
    Acked-by: Mathieu Poirier
    Reviewed-by: Coly Li
    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

27 May, 2018

1 commit

  • general changes:
    - make python dependent on version2 to enable clearlinux
    - upgrade dmesg error/warning extraction to be more detailed
    - enable logs generated from -cmd runs to be processed in gzip form
    - add notification on power mode entry failure into the timeline
    - add -battery option to show if battery is connected and its charge

    summary changes (output of -summary):
    - add -genhtml option to regenerate missing timelines from logs found
    - add min/max/median/avg data to the summary page with links to the data
    - add highlight to minimum, maximum, and median tests
    - add result column to summary (pass or fail) with red highlight on fail
    - add issues column to summary with a list of dmesg err/warn/bugs

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     

22 Feb, 2018

3 commits

  • - add -cgskip option to reduce callgraph output size
    - add -cgfilter option to focus on a list of devices
    - add -result option for exporting batch test results
    - removed all phoronix hooks, use -result to enable batch testing
    - change -usbtopo to -devinfo, now prints all devices
    - add -gzip option to read/write logs in gz format
    - add -bufsize option to manually control ftrace buffer size
    - add -sync option to run filesystem sync prior to test
    - add -display option to enable/disable the display prior to test
    - add -rs option to enable/disable runtime suspend on all devices for test
    - add installed config files to search path
    - add kernel error/warning links into the timeline
    - fix callgraph trace to better handle interrupts
    - include command string and kernel params in timeline output header

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     
  • - add -cgskip option to reduce callgraph output size
    - add -cgfilter option to focus on a list of devices
    - add -result option for exporting batch test results
    - removed all phoronix hooks, use -result to enable batch testing
    - changed argument -f to match sleegraph, -f = -callgraph
    - use -fstat for function status instead of -f
    - add -verbose option to print out timeline stats and kernel options
    - include command string and kernel params in timeline output header

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     
  • - name change: analyze_boot.py to bootgraph.py
    - name change: analyze_suspend.py to sleepgraph.py
    - added config files for easier sleepgraph usage
    - added example.cfg which describes all config options
    - added cgskip.txt definition for slimmer callgraphs

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

22 Jul, 2017

3 commits

  • update help text and man pages for both tools
    - added more examples and separated them by category
    Makefile upgrades
    - uninstall: remove errors from uninstall if tool not found
    - install: perform uninstall before install

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     
  • - changed output from single html file to dir with html/dmesg/ftrace
    - add sysinfo to logs and timeline
    - add -sysinfo command, displays dmidecode values and cpu/mem info
    - set trace buffer size to lesser of memtotal/2 or 2GB when using callgraph
    - extended timeline to the last init call in user space
    separated timeline into two phases, kernel mode & user mode
    - add kernel version check for ftrace usage, 4.10 minimum
    - change -filter argument to -func
    - add strict protections on -func usage with full symbol checks
    now only works for statically linked functions
    cmd -flistall now ignores all loadable module functions
    - add -cgfilter argument for reducing timeline size by removing callgraphs
    - crontab usage: preserve existing @reboot lines in user crontab
    - fedora support added: uses grub2 loader, handles fedora crontab
    - stop using "which" to find binaries, search pre-defined path list
    - moved most output processing to analyze_suspend library

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     
  • - changed -rtcwake parameter to be on & 15 sec by default,
    to disable rtcwake use: "-rtcwake off"
    - changed behavior of -o: renames HTML file on rerun, subdir on new run
    - changed execution_misalignment error to missing_function_name
    - add sysinfo to logs and timeline via a custom dmidecode call
    it supplants dmidecode tool when used as a library call
    - add -sysinfo command, displays dmidecode values and cpu/mem info
    - set trace buffer size to lesser of memtotal/2 or 2GB when using callgraph
    - add support for /sys/power/mem_sleep. if mem_sleep found:
    mem-shallow=standby, mem-s2idle=freeze, mem-deep=mem
    - remove redundant javascript
    - cosmetic changes to HTML layout

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     

20 Apr, 2017

3 commits

  • BootGraph and SleepGraph man pages
    - includes full descriptions of tool arguments and commands
    - includes examples of common use cases

    Makefile
    - no build required, used only for install
    - installs man pages and tools as libraries with links
    - includes an uninstall

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     
  • First release into the kernel tools source
    - pulls in analyze_suspend.py as as library, same html formatting
    - supplants scripts/bootgraph.pl, outputs HTML instead of SVG
    - enables automatic reboot and collection for easy timeline capture
    - enables ftrace callgraph collection from early boot

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt
     
  • Moved from scripts into tools, and updated from 4.5 to 4.6
    - Changed the tool title to SleepGraph
    - Reformatted the code so analyze_suspend can be used as a library
    - Reorganized all html/js/css handling code to be used by other tools
    - upgraded the -summary feature to work faster with better readability

    Signed-off-by: Todd Brandt
    Signed-off-by: Rafael J. Wysocki

    Todd E Brandt