Bug 15161

Summary: suspend/resume changes the hardware clock unexpected - IBM x31 2672
Product: Power Management Reporter: liu_qinyong
Component: Hibernation/SuspendAssignee: power-management_other
Status: CLOSED DOCUMENTED    
Severity: normal CC: acpi-bugzilla, lenb, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.31.5-0.1-default Subsystem:
Regression: No Bisected commit-id:
Bug Depends on:    
Bug Blocks: 7216    
Attachments: dmesg result

Description liu_qinyong 2010-01-28 17:43:03 UTC
Created attachment 24759 [details]
dmesg result

First, either s2disk or s2ram works fine on my laptop (IBM
 x31 2672). I can suspend to disk, to ram without any
 difficulty.
The problem is, after s2disk/s2ram, the system time will be reset
unexpectedly. eg.
====================
 # hwclock; /bin/echo disk >/sys/power/state; hwclock
Thu 28 Jan 2010 04:44:12 PM CET  -0.081849 seconds
Sun 06 Apr 2036 02:54:01 AM CEST  -0.179606 seconds
====================

===========
 # hwclock;s2ram;hwclock
Thu 28 Jan 2010 05:01:39 PM CET  -0.007611 seconds
Switching from vt7 to vt1
Calling radeon_cmd_light(0)
Calling radeon_cmd_light(1)
switching back to vt7
Sun 06 Apr 2036 03:02:01 AM CEST  
===========
I debug s2ram with echo,
==========================
# hwclock ;echo mem > /sys/power/state; hwclock
Thu 28 Jan 2010 05:03:49 PM CET  -0.317434 seconds
Sun 06 Apr 2036 02:54:01 AM CEST  -0.455931 seconds
===========================
Well, this can be solved by resync the hwclock after echo
mem,
hwclock ;echo mem > /sys/power/state; hwclock --systohc; hwclock
Thu 28 Jan 2010 05:07:29 PM CET  -0.181262 seconds
Thu 28 Jan 2010 05:07:56 PM CET  -0.499442 seconds
====================
but, until now, I can not find any method to solve this
problem in s2disk.
%%%%%%%%%%%%%%%%%%%%
System Info
%%%%%%%%%%%%%%%%%%%%
# uname -r
2.6.31.5-0.1-default
This is the kernel shipped with Opensuse 11.2, i have
recompiled it with the default parameters after i changed
the module:
/usr/src/linux-2.6.31.5-0.1/drivers/media/dvb/dvb-usb/dibusb-common.c,
but I have not tested s2ram/s2disk before i loaded the new
module. But, I did all the test without my dvb-usb hardware,
which means, the "dibusb-common" module is not loaded at
all. 

# s2ram -i
This machine can be identified by:
    sys_vendor   = "IBM"
    sys_product  = "2672KA1"
    sys_version  = "ThinkPad X31"
    bios_version = "1QET97WW (3.02 )"
=============================
Comment 1 liu_qinyong 2010-01-28 17:50:58 UTC
By the way, If I switch off my laptop, then switch it on again, or I reboot the system, the hardware clock will not be changed at all. So, I think the problem lies in the step "echo men > /sys/power/state". But, I dont know what happend during this step.
Comment 2 Rafael J. Wysocki 2010-01-28 20:02:16 UTC
What does 'date' show before/after suspend?
Comment 3 liu_qinyong 2010-01-29 13:13:58 UTC
===================
Test I: I rebooted  my laptop 10 Hours ago, use s2ram, 8
hours later, I wake it up, type the following command, and
I waited for 4 mins before i switch on the laptop,  so the
date result is correct. But the hwclock result is set to
year 1980.
============
# date;s2disk -r /dev/sda1;date
Fri Jan 29 08:13:07 CET 2010
Fri Jan 29 08:17:26 CET 2010
============
Test II: I reboot my laptop, and do the following test
immediatly without starting any applications, the results are also correct:
==============================
QY-X31:/home/qinyong # hwclock;date;s2disk -r /dev/sda1;date;hwclock
Fri 29 Jan 2010 08:24:21 AM CET  -0.800493 seconds
Fri Jan 29 08:24:21 CET 2010
Fri Jan 29 08:25:14 CET 2010
Fri 29 Jan 2010 08:25:16 AM CET  -0.849042 seconds
QY-X31:/home/qinyong # hwclock 
Fri 29 Jan 2010 08:25:36 AM CET  -0.961388 seconds
QY-X31:/home/qinyong # hwclock;date;s2ram;hwclock;date
Fri 29 Jan 2010 08:26:15 AM CET  -0.093216 seconds
Fri Jan 29 08:26:14 CET 2010
Switching from vt7 to vt1
Calling radeon_cmd_light(0)
Calling radeon_cmd_light(1)
switching back to vt7
Fri 29 Jan 2010 08:26:27 AM CET  -0.892906 seconds
Fri Jan 29 08:26:26 CET 2010
===============================
After my computer running for 7 hours(during this 7 hours, I used firefox,emacs,wvdial), 
I did the above test again:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Test III
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# date;hwclock ;s2ram ;date;hwclock
Thu Jan 28 13:57:19 CET 2010
Thu 28 Jan 2010 01:57:20 PM CET  -0.529556 seconds
Switching from vt7 to vt1
Calling radeon_cmd_light(0)
Calling radeon_cmd_light(1)
switching back to vt7
Thu Jan 28 13:57:32 CET 2010
Sun 06 Apr 2036 02:54:01 AM CEST  -0.448350 seconds
====================
Well, the date is correct, but the hwclock is changed.

Then, I keep the hwclock value untouched, do a test
hibernate on disk,
====================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Test IV
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# hwclock;date;s2disk -r /dev/sda1;hwclock;date
Sun 06 Apr 2036 02:55:55 AM CEST  -0.091799 seconds
Thu Jan 28 13:59:27 CET 2010
Sun 06 Apr 2036 02:54:01 AM CEST  -0.221551 seconds
Thu Jan 28 13:59:35 CET 2010
=====================
the date value is correct, and hwclock value is unchanged.

Then, I sync the hardware clock with my 'date' value,
did the test again:
=====================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Test V
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 # hwclock;date;s2disk -r /dev/sda1;hwclock;date
Thu 28 Jan 2010 02:01:34 PM CET  -0.365166 seconds
Thu Jan 28 14:01:34 CET 2010
Sun 06 Apr 2036 02:54:02 AM CEST  -1.178611 seconds
Sun Apr  6 03:54:38 CEST 2036
=====================

It's weird.
Comment 4 Rafael J. Wysocki 2010-01-29 19:16:06 UTC
Do you have CONFIG_PM_TRACE set?
Comment 5 liu_qinyong 2010-02-01 12:14:56 UTC
I checked my config file, yes, you are right, the CONFIG_PM_TRACE check box is checked. I will disable this option and try again. I hope this is the reason that makes my computer hardware clock changed. I will post the results when I finish my test. Thank you very much.
Comment 6 liu_qinyong 2010-02-02 08:01:06 UTC
I have compiled my kernel without the option "CONFIG_PM_TRACE", until now, my laptop works fine, and hwclock is not changed at all. Thank you for your help. Since this is not the kernel bug, please close this bug report if necessory.
Comment 7 Rafael J. Wysocki 2010-02-02 20:06:36 UTC
Closing.