Closed Bug 1123528 Opened 6 years ago Closed 6 years ago

[FFOS2.0][Woodduck][Power Management]System repeated resume and suspend when sleep

Categories

(Firefox OS Graveyard :: Gaia::System, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: sync-1, Unassigned)

References

Details

(Whiteboard: [POVB])

Attachments

(7 files)

1.11 KB, application/octet-stream
Details
91.10 KB, application/octet-stream
Details
218.68 KB, application/octet-stream
Details
34.48 KB, application/octet-stream
Details
1.04 KB, patch
Details | Diff | Splinter Review
82.24 KB, application/octet-stream
Details
2.25 KB, text/plain
Details
dear mozilla
 From the kernel log, I found someone will wake up the RTC alarm every ten
 minutes when system sleep. Does gaia or gecko do it?
Attached file wakeup check
Attached file sleep log
Hi Shawn,
Can you help to provide answer here?
Thanks!
Flags: needinfo?(sku)
Blocks: Woodduck
Hi Danny:
 Please help check this issue.

Thanks!!
Shawn
Flags: needinfo?(sku) → needinfo?(dliang)
(In reply to sync-1 from comment #0)
> dear mozilla
>  From the kernel log, I found someone will wake up the RTC alarm every ten
>  minutes when system sleep. Does gaia or gecko do it?

Could you point out the log pattern for RTC alarm? By your log, I didn't find the regular RTC alarm.
Moreover, is this issue reproduced on pure 2.0m build?
Flags: needinfo?(sync-1)
Dear Mozilla
 How about it?
Flags: needinfo?(dliang)
Hi reporter,
Please response the question per comment 5.
keep NI for follow up.
Flags: needinfo?(dliang)
Created an attachment (id=1128785)
 log3
 
 Comment from TCL-PIC-HZ:
 Dear Mozilla:
 I didn't catch gecko log or gaia log, and attachment is the new kernel log, you
 can find key words "alarm time is up".
 MTK told me that maybe gecko or gaia wake up the RTC, I hope you can check it.
 Thanks!
Created an attachment (id=1128785)
 log3
 
 Comment from TCL-PIC-HZ:
 Dear Mozilla:
 I didn't catch gecko log or gaia log, and attachment is the new kernel log, you
 can find key words "alarm time is up".
 MTK told me that maybe gecko or gaia wake up the RTC, I hope you can check it.
 Thanks!
Attached file log3
Created an attachment (id=1128785)
 log3
 
 Comment from TCL-PIC-HZ:
 Dear Mozilla:
 I didn't catch gecko log or gaia log, and attachment is the new kernel log, you
 can find key words "alarm time is up".
 MTK told me that maybe gecko or gaia wake up the RTC, I hope you can check it.
 Thanks!
(In reply to sync-1 from comment #11)
> Created attachment 8552942 [details]
> log3
> 
> Created an attachment (id=1128785)
>  log3
>  
>  Comment from TCL-PIC-HZ:
>  Dear Mozilla:
>  I didn't catch gecko log or gaia log, and attachment is the new kernel log,
> you
>  can find key words "alarm time is up".
>  MTK told me that maybe gecko or gaia wake up the RTC, I hope you can check
> it.
>  Thanks!

Hi reporter,
If you can provide available system log next time, it will be useful and speed up the debug progress.

By my experiments, I add log on https://github.com/mozilla/gecko-dev/blob/b2g32_v2_0m/hal/gonk/GonkHal.cpp#L1084 to monitor if anyone in gecko/gaia set alarm.

In flame 2.0, there is no one to set alarm and we didn't see wake up alarm.
In woodduck 2.0m, we can see someone set alarm by log w/o SIM and w/o wifi connection. I also use gdb to set breakpoint to catch who set rtc alarm, but I didn't find it, that's weird. After check system log, I found there are wifi and mdlogger activities near set alarm. So I did two more tests, one is remove mdlogger and another test under flight mode. The result is I still can see someone set alarm w/o mdlogger, but there is no alarm under flight mode. I strongly suspected the alarm is set by wifi module of vendor.

Hi Woodduck,
Could you help to check if the repeat alarm is caused by your wifi module? Thanks,
Flags: needinfo?(dliang) → needinfo?(wudduc)
CC Zhensen
Created an attachment (id=1131090)
 system log
 
 Comment from TCL-PIC-HZ:
 Dear Mozilla & Woodduck:
 Attach "system_log.rar" is the system log, I hope it is useful for you, thanks!
Created an attachment (id=1131090)
 system log
 
 Comment from TCL-PIC-HZ:
 Dear Mozilla & Woodduck:
 Attach "system_log.rar" is the system log, I hope it is useful for you, thanks!
Attached file system log
Created an attachment (id=1131090)
 system log
 
 Comment from TCL-PIC-HZ:
 Dear Mozilla & Woodduck:
 Attach "system_log.rar" is the system log, I hope it is useful for you, thanks!
Hi Chaozhong, Please check comment #12. Thanks. (ALPS01914991)
Flags: needinfo?(wudduc) → needinfo?(chaozhong.liang)
Log3.rar shows that WiFi is not enabled.
Flags: needinfo?(chaozhong.liang)
Comment from TCL-PIC-HZ:
 Dear Mozilla:
 Could you help to check whether WIFI module wake up alarm every ten minutes?
 thanks!
(In reply to sync-1 from comment #19)
> Comment from TCL-PIC-HZ:
>  Dear Mozilla:
>  Could you help to check whether WIFI module wake up alarm every ten minutes?
>  thanks!

Sure, I can help to confirm again. 
But we cannot reproduce this issue on flame 2.0, maybe it is not caused by gecko/gaia.
Suggest your guys can also check it in parallel.
Flags: needinfo?(dliang)
This is a patch to confirm if RTC alarm is triggered by gecko/gaia.
Hi reporter,
By your attached log, the wifi is disabled, and I cannot reproduce this issue w/ wifi disable.
By my observation, there is one 10 minutes alarm when wifi is on, it's caused by https://github.com/mozilla-b2g/gaia/blob/v2.1s/apps/system/js/wifi.js#L207, it's normal one.

So, I think we are talking about different question.

You can try my attached patch to check if alarm is caused by gecko/gaia.
If there is no message "Set alarm successfully" in system log, it means the alarm is not caused by gecko/gaia. If yes, maybe you need to check your own modification.
Let me know if any further question.
Flags: needinfo?(dliang)
Created an attachment (id=1142856)
 system log
 
 Comment from TCL-PIC-HZ:
 Dear Mozilla:
 I am sorry, I were out of office on 28 and 29.
 I have test the patch, but there is no "Set alarm successfully" in system log.
 Attachment is the system log.
 I will do more test.
Created an attachment (id=1142856)
 system log
 
 Comment from TCL-PIC-HZ:
 Dear Mozilla:
 I am sorry, I were out of office on 28 and 29.
 I have test the patch, but there is no "Set alarm successfully" in system log.
 Attachment is the system log.
 I will do more test.
Attached file system log
Created an attachment (id=1142856)
 system log
 
 Comment from TCL-PIC-HZ:
 Dear Mozilla:
 I am sorry, I were out of office on 28 and 29.
 I have test the patch, but there is no "Set alarm successfully" in system log.
 Attachment is the system log.
 I will do more test.
(In reply to sync-1 from comment #25)
> Created attachment 8556994 [details]
> system log
> 
> Created an attachment (id=1142856)
>  system log
>  
>  Comment from TCL-PIC-HZ:
>  Dear Mozilla:
>  I am sorry, I were out of office on 28 and 29.
>  I have test the patch, but there is no "Set alarm successfully" in system
> log.
>  Attachment is the system log.
>  I will do more test.

Could you provide the log with timestamp? it's good for debugging.
Moreover, may I know your test environment? and STR in detail.
Comment from TCL-PIC-HZ:
 Dear Mozilla:
 The test environment is:
 1.Power on the phone;
 2.Connect USB cable;
 3.Phone suspend(Wifi is disabled);
 4.Use "adb logcat" command to pull out the system log.
 
 I will add timestamp next time.
(In reply to sync-1 from comment #27)
> Comment from TCL-PIC-HZ:
>  Dear Mozilla:
>  The test environment is:
>  1.Power on the phone;
>  2.Connect USB cable;
>  3.Phone suspend(Wifi is disabled);
>  4.Use "adb logcat" command to pull out the system log.
>  
>  I will add timestamp next time.

Is this test steps same as before? System won't sleep when you connect USB cable, could you use your own logger to save logs rather than connecting USB cable.
Flags: needinfo?(binpeng.huang.hz)
(In reply to comment #20)
 > Comment from Mozilla:(In reply to sync-1 from comment #27)
 > > Comment from TCL-PIC-HZ:
 > >  Dear Mozilla:
 > >  The test environment is:
 > >  1.Power on the phone;
 > >  2.Connect USB cable;
 > >  3.Phone suspend(Wifi is disabled);
 > >  4.Use "adb logcat" command to pull out the system log.
 > >  
 > >  I will add timestamp next time.
 > 
 > Is this test steps same as before? System won't sleep when you connect USB
 > cable, could you use your own logger to save logs rather than connecting USB
 > cable.
 > 
 Yes, this test steps was same as before.
 I have catch whole log with mtklogger tool(without USB cable).
 Since the log is too large, you can get the log with below link:
 http://pan.baidu.com/s/1ntsoBgP
 password:sn0i
 Please help to check if someone set RTC alarm, thanks!
Flags: needinfo?(binpeng.huang.hz) → needinfo?(dliang)
(In reply to sync-1 from comment #29)
> (In reply to comment #20)
>  > Comment from Mozilla:(In reply to sync-1 from comment #27)
>  > > Comment from TCL-PIC-HZ:
>  > >  Dear Mozilla:
>  > >  The test environment is:
>  > >  1.Power on the phone;
>  > >  2.Connect USB cable;
>  > >  3.Phone suspend(Wifi is disabled);
>  > >  4.Use "adb logcat" command to pull out the system log.
>  > >  
>  > >  I will add timestamp next time.
>  > 
>  > Is this test steps same as before? System won't sleep when you connect USB
>  > cable, could you use your own logger to save logs rather than connecting
> USB
>  > cable.
>  > 
>  Yes, this test steps was same as before.
>  I have catch whole log with mtklogger tool(without USB cable).
>  Since the log is too large, you can get the log with below link:
>  http://pan.baidu.com/s/1ntsoBgP
>  password:sn0i
>  Please help to check if someone set RTC alarm, thanks!

I didn't find keyword "Set alarm successfully" in logs, that means the rtc alarm is not set by gecko/gaia. Suggest you can call dump_stack() when you setting rtc alarm in rtc driver, it should point out who set the alarm in driver.
Flags: needinfo?(dliang)
Dear Mozilla:
 Is there someone "wake up" the RTC alarm?
(In reply to sync-1 from comment #31)
> Dear Mozilla:
>  Is there someone "wake up" the RTC alarm?

By your comment 11, I think yes, there are some rtc alarm, but these alarm are not set by gecko/gaia, please see comment 30.
Dear Mozilla:
 Thanks for your suggestion on Comment #22, I will discuss with MTK.
 And please keep this issue opened, maybe I will ask you some questions again.
Dear Mozilla:
 I had catch the dump_stack info.
 From these info, I found the system resume by do_exit() API, it means that there
 are some processes exit by exit() API in the user space.
 Could you help to check are there some processes repeat exit when system
 sleep?
 Thanks!
(In reply to sync-1 from comment #34)
> Dear Mozilla:
>  I had catch the dump_stack info.
>  From these info, I found the system resume by do_exit() API, it means that
> there
>  are some processes exit by exit() API in the user space.
>  Could you help to check are there some processes repeat exit when system
>  sleep?
>  Thanks!

hmm...I don't think so. I think the flow is someone set RTC alarm, when time is up, alarm fired and wake up system. There is no API can wake up system immediately.

Moreover, what's the call stack when you set rtc alarm in driver?
Dear Mozilla:
 Here is the dump_stack info:
 [  145.734191]-(0)[5:kworker/u:0][get_md_wakeup_src] get_md_wakeup_src
 
 [  145.734980]-(0)[5:kworker/u:0]Backtrace: 
 
 [  145.735494]-(0)[5:kworker/u:0][<c001212c>] (dump_backtrace+0x0/0x10c) from [<c06dcba4>] (dump_stack+0x18/0x1c)
 
 [  145.736740]-(0)[5:kworker/u:0] r6:c09adc48 r5:00000000 r4:271ae95f r3:271ae95f
 
 [  145.737647]-(0)[5:kworker/u:0][<c06dcb8c>] (dump_stack+0x0/0x1c) from [<c033a828>] (get_md_wakeup_src+0x6c/0x22c)
 
 [  145.738934]-(0)[5:kworker/u:0][<c033a7bc>] (get_md_wakeup_src+0x0/0x22c) from [<c00447d8>] (exec_ccci_kern_func_by_md_id+0x4c/0xd4)
 
 [  145.740418]-(0)[5:kworker/u:0][<c004478c>] (exec_ccci_kern_func_by_md_id+0x0/0xd4) from [<c002fcb4>] (spm_go_to_sleep+0xd0/0xe8)
 
 [  145.741860]-(0)[5:kworker/u:0] r7:00000003 r6:c09aeb0c r5:60000093 r4:c09bc1c8
 
 [  145.742768]-(0)[5:kworker/u:0][<c002fbe4>] (spm_go_to_sleep+0x0/0xe8) from [<c003212c>] (slp_suspend_ops_enter+0xa0/0x22c)
 
 [  145.744144]-(0)[5:kworker/u:0] r5:c09bbef8 r4:c0a71c94
 
 [  145.744792]-(0)[5:kworker/u:0][<c003208c>] (slp_suspend_ops_enter+0x0/0x22c) from [<c00b2800>] (suspend_devices_and_enter+0x248/0x34c)
 
 [  145.746299]-(0)[5:kworker/u:0] r6:c09aeb0c r5:00000000 r4:c0a9a2f4
 
 [  145.747075]-(0)[5:kworker/u:0][<c00b25b8>] (suspend_devices_and_enter+0x0/0x34c) from [<c00b2a58>] (enter_state+0x154/0
(In reply to sync-1 from comment #36)
> Dear Mozilla:
>  Here is the dump_stack info:
>  [  145.734191]-(0)[5:kworker/u:0][get_md_wakeup_src] get_md_wakeup_src
>  
>  [  145.734980]-(0)[5:kworker/u:0]Backtrace: 
>  
>  [  145.735494]-(0)[5:kworker/u:0][<c001212c>] (dump_backtrace+0x0/0x10c)
> from [<c06dcba4>] (dump_stack+0x18/0x1c)
>  
>  [  145.736740]-(0)[5:kworker/u:0] r6:c09adc48 r5:00000000 r4:271ae95f
> r3:271ae95f
>  
>  [  145.737647]-(0)[5:kworker/u:0][<c06dcb8c>] (dump_stack+0x0/0x1c) from
> [<c033a828>] (get_md_wakeup_src+0x6c/0x22c)
>  
>  [  145.738934]-(0)[5:kworker/u:0][<c033a7bc>] (get_md_wakeup_src+0x0/0x22c)
> from [<c00447d8>] (exec_ccci_kern_func_by_md_id+0x4c/0xd4)
>  
>  [  145.740418]-(0)[5:kworker/u:0][<c004478c>]
> (exec_ccci_kern_func_by_md_id+0x0/0xd4) from [<c002fcb4>]
> (spm_go_to_sleep+0xd0/0xe8)
>  
>  [  145.741860]-(0)[5:kworker/u:0] r7:00000003 r6:c09aeb0c r5:60000093
> r4:c09bc1c8
>  
>  [  145.742768]-(0)[5:kworker/u:0][<c002fbe4>] (spm_go_to_sleep+0x0/0xe8)
> from [<c003212c>] (slp_suspend_ops_enter+0xa0/0x22c)
>  
>  [  145.744144]-(0)[5:kworker/u:0] r5:c09bbef8 r4:c0a71c94
>  
>  [  145.744792]-(0)[5:kworker/u:0][<c003208c>]
> (slp_suspend_ops_enter+0x0/0x22c) from [<c00b2800>]
> (suspend_devices_and_enter+0x248/0x34c)
>  
>  [  145.746299]-(0)[5:kworker/u:0] r6:c09aeb0c r5:00000000 r4:c0a9a2f4
>  
>  [  145.747075]-(0)[5:kworker/u:0][<c00b25b8>]
> (suspend_devices_and_enter+0x0/0x34c) from [<c00b2a58>] (enter_state+0x154/0

Could you help to call dump_stack() when you setting rtc alarm in rtc driver?
By call stack, I think you are dumping stack when system resume, right?
Created an attachment (id=1154439)
 dump stack
 
 I am sorry, please see attachment.
 And who wake up system repeattly, I will confirm with MTK again.
Created an attachment (id=1154439)
 dump stack
 
 I am sorry, please see attachment.
 And who wake up system repeattly, I will confirm with MTK again.
Attached file dump stack
Created an attachment (id=1154439)
 dump stack
 
 I am sorry, please see attachment.
 And who wake up system repeattly, I will confirm with MTK again.
Flags: needinfo?(wudduc)
Priority: P2 → P1
Flags: needinfo?(sync-1) → needinfo?(chien-hao.li)
Close as this issue is on BSP partner side.
No longer blocks: Woodduck_Blocker
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(wudduc)
Flags: needinfo?(chien-hao.li)
Resolution: --- → WORKSFORME
Whiteboard: [POVB]
You need to log in before you can comment on or make changes to this bug.