Suspend - Resume in Hikey970

Hi,

I am using Hikey970 board. After writing “mem” device goes to suspend state properly within few seconds.
But Once i press power button (on the board) it takes more time(~45 secs) to resume, and i don’t see any log on the console except this “NOTICE: [set_ics_power_up] done!”.
I don’t see logs related to resume also, unable to debug why it is taking more time to resume.
Any suggestions?

hikey970:/ #
hikey970:/ # echo mem > /sys/power/state

[ 48.341397] PM: suspend entry 2019-09-11 11:27:55.271446870 UTC
[ 48.347410] PM: Syncing filesystems … done.
[ 48.352391] PM: Preparing system for sleep (mem)
[ 48.358483] Freezing user space processes … (elapsed 0.004 seconds) done.
[ 48.370465] Freezing remaining freezable tasks … (elapsed 0.003 seconds) done.
[ 48.381194] PM: Suspending system (mem)
[ 48.385081] Suspending console(s) (use no_console_suspend to debug)
NOTICE: [set_ics_power_down] done!
NOTICE: [set_ics_power_up] done!

Hi,

Two suggestions:

  • Disable console suspend either by adding “no_console_suspend” to kernel command line, or at runtime:
echo "N" > /sys/module/printk/parameters/console_suspend
  • Enable PM debug with below command, this can allow you to get to know which suspend/resume call takes a long time.
echo 'func pm_dev_dbg +p' > /sys/kernel/debug/dynamic_debug/control

Credits to @Loic :), who summarized before for system suspend/resume debugging.

Hi Leo,

Thanks for the suggestions.

I am not able to enable PM debug with the given command, since dynamic_debug is not available in my device. Any other way to enable PM debug and find out which call is taking more time during resume??

2|hikey970:/ #
2|hikey970:/ # echo “N” > /sys/module/printk/parameters/console_suspend
hikey970:/ #
hikey970:/ # echo ‘func pm_dev_dbg +p’ > /sys/kernel/debug/dynamic_debug/control
/system/bin/sh: can’t create /sys/kernel/debug/dynamic_debug/control: No such file or directory
1|hikey970:/ #
1|hikey970:/ # cd /sys
sys/ system/
1|hikey970:/ # cd /sys/kernel/debug/
asoc/ clk/ extfrag/ hid/ kvm/ mmc1/ pm_qos/ regulator/ suspend_stats wakeup_sources
bdi/ debug_enabled fault_around_bytes ieee80211/ mali0/ opp/ pwm rt-regmap/ ti-st/
binder/ dma_buf/ ff100000.dwc3/ iio/ memblock/ pinctrl/ ras/ sleep_time usb/
bluetooth/ dri/ gpio ion/ mmc0/ pm_genpd/ regmap/ split_huge_pages virtio-ports/
1|hikey970:/ # cd /sys/kernel/debug/

Hi,

Since it doesn’t enable trace config in the kernel, you cannot use Ftrace related debugging features (function tracing, kprobe, etc).

If it’s lucky, you could send Sysrq commands. E.g. if use minicom, so I can use ‘Ctrl-a z f’ to send break and follow char ‘l’ to backtrace all live CPUs. This can dump backtrace and thus you can know where CPU is running. More detailed info please refer: https://www.kernel.org/doc/Documentation/admin-guide/sysrq.rst