public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: linux-kernel@vger.kernel.org, plazmcman@softhome.net
Subject: Re: Screwy clock after apm suspend
Date: Mon, 3 Jan 2005 18:34:29 +0100	[thread overview]
Message-ID: <20050103173428.GA10065@elf.ucw.cz> (raw)
In-Reply-To: <200412291138.iBTBcbw6023631@harpo.it.uu.se>

Hi!

> >2.6.10 screws up my system clock.
> >Two kernel/hardware clock readings, before and after suspend.
> >-------------
> >plaz@gonzo:~$ date ;hwclock
> >Tue Dec 28 15:52:39 PST 2004
> >Tue Dec 28 14:54:07 2004 -0.503621 seconds
> >#suspend, resume
> >plaz@gonzo:~$ date ;hwclock
> >Tue Dec 28 16:11:58 PST 2004
> >Tue Dec 28 15:04:06 2004 -0.168262 seconds
> ...
> >I did not have this problem with 2.6.9. My machine uses APM, clock 
> >stores local time (specified in kernel config). I use PIT for 
> >timesource, as others were losing ticks when on battery power (changes 
> >CPU clock speed). Again, did _not_ have this problem with 2.6.9.
> 
> I reported this problem a while ago for 2.6.10-rc1:
> http://marc.theaimsgroup.com/?l=linux-kernel&m=110172841429272&w=2.
> At the time I thought the APM daemon's hwclock --hctosys at resume
> might be in conflict with the kernel change, but I've since disabled
> that and it didn't solve the problem.
> 
> For now, I'm using the patch below to revert the i386 time.c's
> behaviour to what it was before the broken change in 2.6.10-rc1.


Hmm, this will break time on ACPI systems :-(. Perhaps what we want is
equivalent of hwclock --hctosys here?

> --- linux-2.6.10/arch/i386/kernel/time.c.~1~	2004-12-25 12:16:17.000000000 +0100
> +++ linux-2.6.10/arch/i386/kernel/time.c	2004-12-25 23:56:19.000000000 +0100
> @@ -319,7 +319,7 @@ unsigned long get_cmos_time(void)
>  	return retval;
>  }
>  
> -static long clock_cmos_diff, sleep_start;
> +static long clock_cmos_diff;
>  
>  static int timer_suspend(struct sys_device *dev, u32 state)
>  {
> @@ -328,7 +328,6 @@ static int timer_suspend(struct sys_devi
>  	 */
>  	clock_cmos_diff = -get_cmos_time();
>  	clock_cmos_diff += get_seconds();
> -	sleep_start = get_cmos_time();
>  	return 0;
>  }
>  
> @@ -336,19 +335,16 @@ static int timer_resume(struct sys_devic
>  {
>  	unsigned long flags;
>  	unsigned long sec;
> -	unsigned long sleep_length;
>  
>  #ifdef CONFIG_HPET_TIMER
>  	if (is_hpet_enabled())
>  		hpet_reenable();
>  #endif
>  	sec = get_cmos_time() + clock_cmos_diff;
> -	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!

  reply	other threads:[~2005-01-03 19:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-29 11:38 Screwy clock after apm suspend Mikael Pettersson
2005-01-03 17:34 ` Pavel Machek [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-01-15 18:30 Mikael Pettersson
2005-01-16 19:47 ` Alex Romosan
2005-01-07 18:08 Shaw
2005-01-09 22:47 ` Pavel Machek
2005-01-10  2:15   ` Alex Romosan
2005-01-10  7:28   ` Shaw
2005-01-10  7:44     ` bernard
2005-01-10 10:57       ` Pavel Machek
2005-01-10 17:48         ` Bernard Blackham
2005-01-11  0:14           ` Pavel Machek
2005-01-11  1:10             ` Nigel Cunningham
2005-01-11  3:12               ` Pavel Machek
2005-01-11  1:16             ` Bernard Blackham
2005-01-11  3:21               ` Pavel Machek
2005-01-11 12:36               ` Mikael Pettersson
2005-01-11 13:10                 ` Pavel Machek
2005-01-11 14:15                   ` Mikael Pettersson
2005-01-11 20:18                     ` Pavel Machek
2005-01-11  3:13             ` Stephen Rothwell
2005-01-11  3:19               ` Pavel Machek
2005-01-11 12:32                 ` Mikael Pettersson
2004-12-29  0:29 Brannon Klopfer
2004-12-29  1:18 ` Nigel Cunningham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050103173428.GA10065@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@csd.uu.se \
    --cc=plazmcman@softhome.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox