Looking at the strace output one can see that powerd gets the power button press notification, processes it, and then nothing happens for half a second:
If you look close enough you can see that pid 949 does a blocking write of the string "on" to /sys/power/state, and this syscall comes back half a second later. Half a second. Exactly the missing time we are looking for.
So I pressed the power button to turn off the screen, waited a couple of seconds to allow the system go to sleep, and did the following:
root@ubuntu-phablet:~# time echo "on" > /sys/power/state
real 0m0.545s
user 0m0.000s
sys 0m0.000s
Something in the kernel seems to take roughly half a second to wake up.
I looked at the Documentation/power/states.txt file of the Linux kernel and was am a bit confused: There should be only four valid values one can write to /sys/power/state, namely "mem", "standby", "freeze" and "disk". On the bq phone the file contains "mem disk", so only those two states are available. I found out that "on" seems to be an accepted value on Android kernels only.
So the root of the problem my lie in kernel land at the end.
Looking at the strace output one can see that powerd gets the power button press notification, processes it, and then nothing happens for half a second:
[pid 949] 1430318963.039809 send(3, "<31>Apr 29 16:49:23 powerd[949]: exiting suspend", 48, MSG_NOSIGNAL) = 48 {1430318963, 40921}, NULL) = 0 sys/power/ state", O_WRONLY) = 14 /sys/power/ state>, "on", 2 <unfinished ...>
[pid 949] 1430318963.040868 gettimeofday(
[pid 949] 1430318963.041289 send(3, "<31>Apr 29 16:49:23 powerd[949]: libsuspend: exit_suspend.", 58, MSG_NOSIGNAL) = 58
[pid 949] 1430318963.042623 open("/
[pid 949] 1430318963.043483 write(14<
<Note: 508 milliseconds delay>
[pid 8256] 1430318963.515663 <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out) CLOCK_MONOTONIC , {27280, 493365943}) = 0 CLOCK_MONOTONIC , {27280, 493965482}) = 0 /sys/power/ wait_for_ fb_wake> ) = 0 sys/power/ wait_for_ fb_sleep" , O_RDONLY) = 7 /sys/power/ wait_for_ fb_sleep> , <unfinished ...>
[pid 8256] 1430318963.515862 clock_gettime(
[pid 8256] 1430318963.517005 clock_gettime(
[pid 8256] 1430318963.518207 futex(0xaa430c, FUTEX_WAIT, 30, {14, 999399518} <unfinished ...>
[pid 971] 1430318963.587966 <... read resumed> "a", 1) = 1
[pid 971] 1430318963.588263 close(7<
[pid 971] 1430318963.589699 open("/
[pid 971] 1430318963.590953 read(7<
[pid 949] 1430318963.592034 <... write resumed> ) = 2
If you look close enough you can see that pid 949 does a blocking write of the string "on" to /sys/power/state, and this syscall comes back half a second later. Half a second. Exactly the missing time we are looking for.
So I pressed the power button to turn off the screen, waited a couple of seconds to allow the system go to sleep, and did the following:
root@ubuntu- phablet: ~# time echo "on" > /sys/power/state
real 0m0.545s
user 0m0.000s
sys 0m0.000s
Something in the kernel seems to take roughly half a second to wake up.
I looked at the Documentation/ power/states. txt file of the Linux kernel and was am a bit confused: There should be only four valid values one can write to /sys/power/state, namely "mem", "standby", "freeze" and "disk". On the bq phone the file contains "mem disk", so only those two states are available. I found out that "on" seems to be an accepted value on Android kernels only.
So the root of the problem my lie in kernel land at the end.