All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.6.9 S4: clock not updated after resume
@ 2004-10-21 12:21 Luca Capello
       [not found] ` <4177A9DC.7060503-wlebWZzHoyE@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Luca Capello @ 2004-10-21 12:21 UTC (permalink / raw)
  To: ML ACPI-devel

-----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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.6.9 S4: clock not updated after resume
       [not found] ` <4177A9DC.7060503-wlebWZzHoyE@public.gmane.org>
@ 2004-10-21 20:20   ` Pavel Machek
       [not found]     ` <20041021202051.GA21624-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2004-10-21 20:20 UTC (permalink / raw)
  To: ML ACPI-devel

Hi!

> 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
--- clean/arch/i386/kernel/time.c	2004-10-01 00:29:59.000000000 +0200
+++ linux/arch/i386/kernel/time.c	2004-10-19 15:16:14.000000000 +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;
 }
 


-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.6.9 S4: clock not updated after resume
       [not found]     ` <20041021202051.GA21624-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
@ 2004-10-22  8:10       ` Luca Capello
  2004-10-23 15:03         ` Jon Valvatne
  0 siblings, 1 reply; 6+ messages in thread
From: Luca Capello @ 2004-10-22  8:10 UTC (permalink / raw)
  To: ML ACPI-devel

[-- Attachment #1: Type: text/plain, Size: 2655 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Pavel,

on 10/21/04 22:20, Pavel Machek wrote:
> 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-----

[-- Attachment #2: syslog_20041022.gz --]
[-- Type: application/x-gzip, Size: 10117 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.6.9 S4: clock not updated after resume
  2004-10-22  8:10       ` Luca Capello
@ 2004-10-23 15:03         ` Jon Valvatne
       [not found]           ` <loom.20041023T170041-953-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Jon Valvatne @ 2004-10-23 15:03 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Luca Capello <luca@...> writes:

> 
> Hi Pavel,
> 
> on 10/21/04 22:20, Pavel Machek wrote:
> > 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: 2.6.9 S4: clock not updated after resume
       [not found]           ` <loom.20041023T170041-953-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
@ 2004-10-23 17:49             ` Luca Capello
       [not found]               ` <417A99B4.40707-wlebWZzHoyE@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Luca Capello @ 2004-10-23 17:49 UTC (permalink / raw)
  To: ML ACPI-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

on 10/23/04 17:03, Jon Valvatne wrote:
> 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 :-)

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: 2.6.9 S4: clock not updated after resume
       [not found]               ` <417A99B4.40707-wlebWZzHoyE@public.gmane.org>
@ 2004-10-26 20:01                 ` Luca Capello
  0 siblings, 0 replies; 6+ messages in thread
From: Luca Capello @ 2004-10-26 20:01 UTC (permalink / raw)
  To: ML ACPI-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

on 10/23/04 19:49, Luca Capello wrote:
> on 10/23/04 17:03, Jon Valvatne wrote:
>> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-10-26 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 12:21 2.6.9 S4: clock not updated after resume Luca Capello
     [not found] ` <4177A9DC.7060503-wlebWZzHoyE@public.gmane.org>
2004-10-21 20:20   ` Pavel Machek
     [not found]     ` <20041021202051.GA21624-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2004-10-22  8:10       ` Luca Capello
2004-10-23 15:03         ` Jon Valvatne
     [not found]           ` <loom.20041023T170041-953-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2004-10-23 17:49             ` Luca Capello
     [not found]               ` <417A99B4.40707-wlebWZzHoyE@public.gmane.org>
2004-10-26 20:01                 ` Luca Capello

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.