intel / pm-graph

The Suspend/Resume project provides a tool for system developers to visualize the activity between suspend and resume, allowing them to identify inefficiencies and bottlenecks.
https://01.org/suspendresume
GNU General Public License v2.0
133 stars 54 forks source link

No systemd notification when user suspend system by sleepgraph #28

Open KaiChuan-Hsieh opened 6 months ago

KaiChuan-Hsieh commented 6 months ago

Hello,

sleepgraph utilize sysfs node to suspend the system, ex: $ echo mem > /sys/power/state. Some devices customize the pre-sleep or post-resume operations by utilizing systemd sleep script, ex: Nvidia proprietary driver. It may cause some problem on the device that needs pre-sleep or post-resume operations.

Reproduce steps:

On Ubuntu 22.04 system with NV graphic

  1. install nvidia driver by $ sudo ubuntu-drivers install nvidia:535
  2. Suspend the system by $ sleepgraph -m freeze -rtcwake 60 -sync -gzip -multi 1 0 -skiphtml
  3. The nvidia-sleep.sh won't be triggered

Thanks,

tebrandt commented 5 months ago

You can run a custom suspend command with the "-cmd" option. For instance "sleepgraph -cmd "mysuspendscript.sh" -dev -proc" will call "mysuspendscript.sh" instead of "echo mode > /sys/power/state". We use -cmd all the time on android and chrome since both have significant pre-suspend calls to do. The tool will run over the whole command and create the timeline of what happens in the kernel. Using the -proc argument will show all the processes that your "-cmd" call initiated before the kernel suspend started.