Bug 7520

Summary: suspend fools kernel boottime
Product: Power Management Reporter: Beno (benoit)
Component: Hibernation/SuspendAssignee: Rafael J. Wysocki (rjwysocki)
Status: CLOSED CODE_FIX    
Severity: normal    
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.18.2 Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 7216    

Description Beno 2006-11-14 05:35:18 UTC
Hi,
	i'm using vanilla 2.6.18.2 on ppc. Suspend works great but fools '/proc/stat'
btime field so i can't retrieve the real boottime. This results in a incorrect
uptime too.

The kernel log is also inaccurate because :

Nov 12 21:28:47 ibook kernel: [117064.806160] hda: Enabling Ultra DMA 5
Nov 12 21:28:47 ibook kernel: [117064.815242] hdc: Enabling MultiWord DMA 2
<suspend all night long>
Nov 13 18:53:28 ibook kernel: [117065.585814] adb: starting probe task...
Nov 13 18:53:28 ibook kernel: [117065.840089] ADB keyboard at 2, handler 1


I actually booted on :

Nov  7 18:53:34 ibook kernel: [    0.000000] Linux version 2.6.18.2-ben
(benoit@ibook) (version gcc 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)) #3
Mon Nov 6 18:39:04 CET 2006

but today 13 of November, last kernel message is :

Nov 13 21:16:03 ibook kernel: [119673.200183] [drm] Loading R200 Microcode

which means that uptime is about 1 day and 9h which is wrong

grep btime /proc/stat
btime 1163329310 # Sun Nov 12 12:01:50 2006

which is wrong too.

So please fix, keep btime unchanged.
Comment 1 Rafael J. Wysocki 2007-06-18 10:18:35 UTC
Is the problem still present in the latest -rc and/or -git kernels?
Comment 2 Beno 2007-08-08 12:02:27 UTC
Still in 2.6.22.1

@rjwysocki@sisk.pl : tell me what data you need instead of acting like a mozilla jerk.
Comment 3 Rafael J. Wysocki 2007-08-08 13:02:16 UTC
I need you to answer my questions, which you didn't.

Besides, I have no such problems on x86_64 and i386, so it seems to be ppc-specific.  Unfortunately, I know nothing about ppc, so I'm afraid I can't help you.
Comment 4 Beno 2007-08-09 10:43:35 UTC
There was some commits about this in 2.6.23-rc1 :

commit d62141414a55ff3f1410b27db2a95224446e77a4
Author: Tomas Janousek <tjanouse@redhat.com>
Date:   Sun Jul 15 23:39:42 2007 -0700

    Use boot based time for uptime in /proc
    
    Commit 411187fb05cd11676b0979d9fbf3291db69dbce2 caused uptime not to increase
    during suspend.  This may cause confusion so I restore the old behaviour by
    using the boot based time instead of monotonic for uptime.
    
    Signed-off-by: Tomas Janousek <tjanouse@redhat.com>
    Acked-by: John Stultz <johnstul@us.ibm.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

commit 924b42d5a2dbe508407a0a6290d3751f826bccdd
Author: Tomas Janousek <tjanouse@redhat.com>
Date:   Sun Jul 15 23:39:42 2007 -0700

    Use boot based time for process start time and boot time in /proc
    
    Commit 411187fb05cd11676b0979d9fbf3291db69dbce2 caused boot time to move and
    process start times to become invalid after suspend.  Using boot based time
    for those restores the old behaviour and fixes the issue.
    
    [akpm@linux-foundation.org: little cleanup]
    Signed-off-by: Tomas Janousek <tjanouse@redhat.com>
    Cc: Tomas Smetana <tsmetana@redhat.com>
    Acked-by: John Stultz <johnstul@us.ibm.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

commit 7c3f1a573237b90ef331267260358a0ec4ac9079
Author: Tomas Janousek <tjanouse@redhat.com>
Date:   Sun Jul 15 23:39:41 2007 -0700

    Introduce boot based time
    
    The commits
    
      411187fb05cd11676b0979d9fbf3291db69dbce2 (GTOD: persistent clock support)
      c1d370e167d66b10bca3b602d3740405469383de (i386: use GTOD persistent clock
        support)
    
    changed the monotonic time so that it no longer jumps after resume, but it's
    not possible to use it for boot time and process start time calculations then.
     Also, the uptime no longer increases during suspend.
    
    I add a variable to track the wall_to_monotonic changes, a function to get the
    real boot time and a function to get the boot based time from the monotonic
    one.
    
    [akpm@linux-foundation.org: remove exports, add comment]
    Signed-off-by: Tomas Janousek <tjanouse@redhat.com>
    Cc: Tomas Smetana <tsmetana@redhat.com>
    Cc: John Stultz <johnstul@us.ibm.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


So i've booted 2.6.23-rc2 and the bug is gone.
Comment 5 Rafael J. Wysocki 2007-08-09 11:38:00 UTC
Good to know. :-)

Can I close the bug now?
Comment 6 Beno 2007-08-09 11:46:26 UTC
Yes please.