Skip to contentSkip to conversation

Resume does not work after timekeeping change

DISCUSSION Jiri Slaby 5 participants 8 messages Apr 20, 2013 – Apr 22, 2013 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

Hi,

my machine does not wake from suspend to RAM on my box running the -next kernel. The last thing I see is "Disabling non-boot CPUs ...". I bisected it to this commit:

commit 7ec98e15aa049b7a2ca73485f31cf4f90c34e2dd

Author: Thomas Gleixner <[email protected]>
Date:   Thu Feb 21 22:51:39 2013 +0000
    timekeeping: Delay update of clock->cycle_last

Reverting that one on the top of -next-20130419 makes it work again.

I also tried it inside a VM using suspend to disk. There, it behaves like it takes a minute or so to wake up. So I tried to wait on the real HW too, but it never resumes there.

regards,

Signature · 2 lines
js
suse labs
#1 lore raw
Quoted 13 lines · Jiri Slaby

Hi,

my machine does not wake from suspend to RAM on my box running the -next kernel. The last thing I see is "Disabling non-boot CPUs ...". I bisected it to this commit:

commit 7ec98e15aa049b7a2ca73485f31cf4f90c34e2dd

Author: Thomas Gleixner <[email protected]>
Date:   Thu Feb 21 22:51:39 2013 +0000
    timekeeping: Delay update of clock->cycle_last
Quoted 6 lines

Reverting that one on the top of -next-20130419 makes it work again.

I also tried it inside a VM using suspend to disk. There, it behaves like it takes a minute or so to wake up. So I tried to wait on the real HW too, but it never resumes there.

Right, and I'm seeing it here too but it sometimes does resume after about a minute or so and sometimes it doesn't.

Reverting the patch by hand ontop of tip/master fixes the issue here too.

Btw, Ingo, remember how I was telling you that I'm seeing temporary lockups with tip/master and resume issues
with the last line being "Disabling non-boot CPUs ..."
http://marc.info/?l=linux-kernel&m=136610574502492 - this commit was the culprit.

Good job Jiri.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#2 lore raw
In reply to Jiri Slaby
Quoted 6 lines · Jiri Slaby

Hi,

my machine does not wake from suspend to RAM on my box running the -next kernel. The last thing I see is "Disabling non-boot CPUs ...". I bisected it to this commit:

Quoted 8 lines

commit 7ec98e15aa049b7a2ca73485f31cf4f90c34e2dd

Author: Thomas Gleixner <[email protected]>
Date:   Thu Feb 21 22:51:39 2013 +0000
    timekeeping: Delay update of clock->cycle_last

Reverting that one on the top of -next-20130419 makes it work again.

Does the patch below fix the issue?

Thanks,

tglx
---

kernel/time/timekeeping.c +1 -1
index 675f720..98cd470 100644
@@ -951,7 +951,7 @@ static void timekeeping_resume(void)
 		__timekeeping_inject_sleeptime(tk, &ts_delta);
 
 	/* Re-base the last cycle value */
-	clock->cycle_last = cycle_now;
+	tk->cycle_last = clock->cycle_last = cycle_now;
 	tk->ntp_error = 0;
 	timekeeping_suspended = 0;
 	timekeeping_update(tk, false, true);
Tested-by
#3 lore raw
Quoted 1 line · Thomas Gleixner

Does the patch below fix the issue?

It does here.

Applied it ontop of tip/master of today and did three suspend/resume cycles, back-to-back - looks good and no hickups.

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
Acked-by
#4 lore raw
In reply to Thomas Gleixner
Quoted 26 lines · Thomas Gleixner
Quoted 6 lines · Jiri Slaby

Hi,

my machine does not wake from suspend to RAM on my box running the -next kernel. The last thing I see is "Disabling non-boot CPUs ...". I bisected it to this commit:

Quoted 8 lines

commit 7ec98e15aa049b7a2ca73485f31cf4f90c34e2dd

Author: Thomas Gleixner <[email protected]>
Date:   Thu Feb 21 22:51:39 2013 +0000
     timekeeping: Delay update of clock->cycle_last

Reverting that one on the top of -next-20130419 makes it work again.

Does the patch below fix the issue?

Thanks,

tglx
---

kernel/time/timekeeping.c +0 -0
index 675f720..98cd470 100644

kernel/time/timekeeping.c static void timekeeping_resume(void) · line 954

Quoted 5 lines
kernel/time/timekeeping.c +1 -1
@@ -951,7 +951,7 @@ static void timekeeping_resume(void)
  		__timekeeping_inject_sleeptime(tk, &ts_delta);
 
  	/* Re-base the last cycle value */
-	clock->cycle_last = cycle_now;
+	tk->cycle_last = clock->cycle_last = cycle_now;

Looks good.

#5 lore raw

[tip:timers/core] timekeeping: Update tk->cycle_last in resume

In reply to Thomas Gleixner
timekeeping: Update tk->cycle_last in resume
Commit-ID:  77c675ba18836802f6b73d2d773481d06ebc0f04
Gitweb:     http://git.kernel.org/tip/77c675ba18836802f6b73d2d773481d06ebc0f04
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Mon, 22 Apr 2013 09:37:04 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 22 Apr 2013 20:17:51 +0200

timekeeping: Update tk->cycle_last in resume

commit 7ec98e15aa (timekeeping: Delay update of clock->cycle_last) forgot to update tk->cycle_last in the resume path. This results in a stale value versus clock->cycle_last and prevents resume in the worst case.

---
 kernel/time/timekeeping.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/timekeeping.c +1 -1
index 675f720..98cd470 100644
@@ -951,7 +951,7 @@ static void timekeeping_resume(void)
 		__timekeeping_inject_sleeptime(tk, &ts_delta);
 
 	/* Re-base the last cycle value */
-	clock->cycle_last = cycle_now;
+	tk->cycle_last = clock->cycle_last = cycle_now;
 	tk->ntp_error = 0;
 	timekeeping_suspended = 0;
 	timekeeping_update(tk, false, true);
#6 lore raw
In reply to Jiri Slaby
Quoted 13 lines · Jiri Slaby

Hi,

my machine does not wake from suspend to RAM on my box running the -next kernel. The last thing I see is "Disabling non-boot CPUs ...". I bisected it to this commit:

commit 7ec98e15aa049b7a2ca73485f31cf4f90c34e2dd

Author: Thomas Gleixner <[email protected]>
Date:   Thu Feb 21 22:51:39 2013 +0000
     timekeeping: Delay update of clock->cycle_last
Quoted 6 lines

Reverting that one on the top of -next-20130419 makes it work again.

I also tried it inside a VM using suspend to disk. There, it behaves like it takes a minute or so to wake up. So I tried to wait on the real HW too, but it never resumes there.

Thanks for chasing this down! Sorry for the trouble, does the following fix resolve this?

thanks
-john

kernel/time/timekeeping.c +1 -0
index 675f720..94041a9 100644
@@ -952,6 +952,7 @@ static void timekeeping_resume(void)
 
 	/* Re-base the last cycle value */
 	clock->cycle_last = cycle_now;
+	tk->cycle_last = cycle_now;
 	tk->ntp_error = 0;
 	timekeeping_suspended = 0;
 	timekeeping_update(tk, false, true);
#7 lore raw
Quoted 14 lines · John Stultz
Quoted 13 lines · Jiri Slaby

Hi,

my machine does not wake from suspend to RAM on my box running the -next kernel. The last thing I see is "Disabling non-boot CPUs ...". I bisected it to this commit:

commit 7ec98e15aa049b7a2ca73485f31cf4f90c34e2dd

Author: Thomas Gleixner <[email protected]>
Date:   Thu Feb 21 22:51:39 2013 +0000
     timekeeping: Delay update of clock->cycle_last
Quoted 9 lines
Quoted 6 lines

Reverting that one on the top of -next-20130419 makes it work again.

I also tried it inside a VM using suspend to disk. There, it behaves like it takes a minute or so to wake up. So I tried to wait on the real HW too, but it never resumes there.

Thanks for chasing this down! Sorry for the trouble, does the following fix resolve this?

Nevermind, I see Thomas already provided the same fix yesterday.

thanks
-john