2.6.9 S4: clock not updated after resume
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I use with success 'echo disk > /sys/power/state' on my ASUS M6N (BIOS 0210A), Debian /experimental/, vanilla 2.6.9, XFree86/GNOME, with all the modules installed (i.e, ALSA, bcm5700, ipw2100, USB, radeonfb, AGP/DRM).
The resume is always ok, even if I suspend from battery or from AC, there're no problem at all. The only remark is that the internal clock is 'freezed' at the time I suspended the machine and I must re-update it using the NTP service. This is not so problematic if your machine is always connected to Internet, but as sometimes I work offline, I should re-update the internal clock by hand.
Is this behaviour normal or is there a bug in the suspend/resume process? Shouldn't the hardware clock be checked during resume to update the internal clock? Please correct me if I'm wrong ;-)
Thx, bye,
Gismo / Luca
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org
iD8DBQFBd6nbVAp7Xm10JmkRAkJZAJ0TonjgxQ8m/GwksbteVQVUAlLRDACdFJzu k5Bk5VelSgWmzJigdp6QO/U=
=6+IM
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
Hi!
Quoted 10 lines
I use with success 'echo disk >
/sys/power/state' on my ASUS M6N (BIOS 0210A), Debian /experimental/, vanilla 2.6.9, XFree86/GNOME, with all the modules installed (i.e, ALSA, bcm5700, ipw2100, USB, radeonfb, AGP/DRM).The resume is always ok, even if I suspend from battery or from AC, there're no problem at all. The only remark is that the internal clock is 'freezed' at the time I suspended the machine and I must re-update it using the NTP service. This is not so problematic if your machine is always connected to Internet, but as sometimes I work offline, I should re-update the internal clock by hand.
It is a bug, here's the fix.
Pavel
arch/i386/kernel/time.c +5 -1
@@ -319,7 +319,7 @@return retval; } -static long clock_cmos_diff; +static long clock_cmos_diff, sleep_start;static int time_suspend (struct sys_device *dev,u32 state) {
@@ -328,6 +328,7 @@*/ clock_cmos_diff = -get_cmos_time (); clock_cmos_diff +=get_seconds (); + sleep_start =get_cmos_time ();return 0 ; }
@@ -335,10 +336,13 @@ {unsigned long flags;unsigned long sec =get_cmos_time () + clock_cmos_diff; +unsigned long sleep_length =get_cmos_time () - sleep_start; +write_seqlock_irqsave (&xtime_lock, flags); xtime.tv_sec = sec; xtime.tv_nsec =0 ;write_sequnlock_irqrestore (&xtime_lock, flags); + jiffies += sleep_length *HZ ;return 0 ; }
Signature · 9 lines
People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl! ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Pavel,
Quoted 1 line · Pavel Machek
It is a bug, here's the fix.
actually, your fix doesn't work, as you can see from the attached
syslog: I still need to synchronise the clock via NTP.
BTW, I'm sure I applied your patch and the kernel is the right one:
=====
luca@gismo:~$ ls -l /lib/modules/2.6.9/ total 200 drwxr-xr-x 2 root root 4096 Oct 22 09:03 bcm lrwxr-xr-x 1 root root 34 Oct 22 09:03 build -> /usr/src/linux-2.6.9-battery-clock drwxr-xr-x 9 root root 4096 Oct 21 02:03 kernel - -rw-r--r-- 1 root root 37325 Oct 22 09:03 modules.alias - -rw-r--r-- 1 root root 69 Oct 22 09:03 modules.ccwmap - -rw-r--r-- 1 root root 18819 Oct 22 09:03 modules.dep - -rw-r--r-- 1 root root 443 Oct 22 09:03 modules.ieee1394map - -rw-r--r-- 1 root root 700 Oct 22 09:03 modules.inputmap - -rw-r--r-- 1 root root 235 Oct 22 09:03 modules.isapnpmap - -rw-r--r-- 1 root root 43506 Oct 22 09:03 modules.pcimap - -rw-r--r-- 1 root root 37599 Oct 22 09:03 modules.symbols - -rw-r--r-- 1 root root 26434 Oct 22 09:03 modules.usbmap lrwxr-xr-x 1 root root 34 Oct 22 09:03 source -> /usr/src/linux-2.6.9-battery-clock drwxr-xr-x 3 root root 4096 Oct 21 02:03 updates
luca@gismo:~$ cd /usr/src
luca@gismo:/usr/src$ diff linux-2.6.9-battery/arch/i386/kernel/time.c
linux-2.6.9-battery-clock/arch/i386/kernel/time.c
- --- linux-2.6.9-battery/arch/i386/kernel/time.c 2004-10-18 23:54:08 +0200
+++ linux-2.6.9-battery-clock/arch/i386/kernel/time.c 2004-10-22
00:33:44 +0200
@@ -319,7 +319,7 @@
return retval;
}- -static long clock_cmos_diff;
+static long clock_cmos_diff, sleep_start;
static int time_suspend(struct sys_device *dev, u32 state) {
@@ -328,6 +328,7 @@
*/
clock_cmos_diff = -get_cmos_time();
clock_cmos_diff += get_seconds();
+ sleep_start = get_cmos_time();
return 0;}
@@ -335,10 +336,13 @@
{
unsigned long flags;
unsigned long sec = get_cmos_time() + clock_cmos_diff;
+ unsigned long sleep_length = get_cmos_time() - sleep_start;
+
write_seqlock_irqsave(&xtime_lock, flags);
xtime.tv_sec = sec;
xtime.tv_nsec = 0;
write_sequnlock_irqrestore(&xtime_lock, flags);
+ jiffies += sleep_length * HZ;
return 0;}
luca@gismo:/usr/src$
=====
I'm here for other tests :-)
Thx, bye,
Gismo / Luca
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org
iD8DBQFBeMBwVAp7Xm10JmkRAipNAKCCUt5346gWnXg7Y8UDP1BvQ5c2cACaAvMV ywsbUI6EmXZ9qe0Jz8z9y3M=
=rSh4
-----END PGP SIGNATURE-----
Quoted 8 lines · Luca Capello
Hi Pavel,
Quoted 1 line · Pavel Machek
It is a bug, here's the fix.
actually, your fix doesn't work, as you can see from the attached
syslog: I still need to synchronise the clock via NTP.
Maybe I'm missing something here, but if the problem is that the kernel doesn't update the system clock from the hardware clock on resume, why bother with NTP? Can't you just do a hwclock --hctosys?
Of course, the proper way is for the kernel to do it, I'm just saying..
Jon
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
Quoted 3 lines · Jon Valvatne
Maybe I'm missing something here, but if the problem is that the kernel doesn't update the system clock from the hardware clock on resume, why bother with NTP? Can't you just do a hwclock --hctosys?
well, I never did it because I didn't know this command, I'll try tomorrow and report :-)
Quoted 1 line
Of course, the proper way is for the kernel to do it, I'm just saying..
As Pavel stated, it's a kernel bug, but the fix he posted didn't worked on my machine.
Thx, bye,
Gismo / Luca
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org
iD8DBQFBepmzVAp7Xm10JmkRAp+lAJ9DMZvJtdx7vUb2LXhqJL9WGdhXKQCcDLL0 8R6A2lvpZ6xzFi+Bu+QRtKU=
=uzPn
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
Quoted 6 lines · Luca Capello
Quoted 3 lines · Jon Valvatne
Maybe I'm missing something here, but if the problem is that the kernel doesn't update the system clock from the hardware clock on resume, why bother with NTP? Can't you just do a hwclock --hctosys?
well, I never did it because I didn't know this command, I'll try tomorrow and report :-)
'hwclock --hctosys' indeed did the trick :-)
Thx, bye,
Gismo / Luca
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org
iD8DBQFBfq0MVAp7Xm10JmkRAiYMAJ0YpRiDDvFCWusH29es4Y9QLl7tUwCfTme8 Vm9H2pjZ4Oj9CiBZMPsyRoc=
=Kbni
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click