All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: johnstul@us.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] Introduce clocksource_forward_now
Date: Thu, 3 Apr 2008 14:07:32 -0700	[thread overview]
Message-ID: <20080403140732.9f30a501.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0804021322490.26791@localhost.localdomain>

On Wed, 2 Apr 2008 13:39:43 +0200 (CEST)
Roman Zippel <zippel@linux-m68k.org> wrote:

> Hi,
> 
> On Tue, 18 Mar 2008, john stultz wrote:
> 
> > My solution is to introduce CLOCK_MONOTONIC_RAW. This exposes a
> > nanosecond based time value, that increments starting at bootup and has
> > no frequency adjustments made to it what so ever.
> 
> There is a problem with the time offset since the last update_wall_time() 
> call, which isn't taken into account when switching clocks (possibly 
> during suspend/resume too), so that the clock might jump back during a 
> clock switch.
> To avoid making the whole more complex it's better to do small cleanup 
> first, so this patch introduces clocksource_forward_now() which takes care 
> of this offset since the last update_wall_time() call and adds it to the 
> clock, so there is no need anymore to deal with it explicitly.
> This is also gets rid of the timekeeping_suspend_nsecs hack, instead of 
> waiting until resume, the value is accumulated during suspend. In the end 
> there is only a single user of __get_nsec_offset() left, so I integrated 
> it back to getnstimeofday().
> 

It's unclear what tree this was agaisnt, but it was the wrong one.

> --- linux-2.6.orig/kernel/time/timekeeping.c
> +++ linux-2.6/kernel/time/timekeeping.c

Hopefully these changes will work when mixed with the pending 2.6.26
changes, but nobody yet knows.

> @@ -459,10 +452,10 @@ void update_wall_time(void)
>  	 */
>  	while (offset >= clock->cycle_interval) {
>  		/* accumulate one interval */
> -		clock->xtime_nsec += clock->xtime_interval;
> -		clock->cycle_last += clock->cycle_interval;
>  		offset -= clock->cycle_interval;
> +		clock->cycle_last += clock->cycle_interval;
>  
> +		clock->xtime_nsec += clock->xtime_interval;
>  		if (clock->xtime_nsec >= (u64)NSEC_PER_SEC << clock->shift) {
>  			clock->xtime_nsec -= (u64)NSEC_PER_SEC << clock->shift;
>  			xtime.tv_sec++;

This do-nothing change conflited with
clocksource-introduce-clock_monotonic_raw.patch (and fixes).  Please check
that the result is OK (ie: clocksource.raw_snsec ddd not need any changes)



  parent reply	other threads:[~2008-04-03 21:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-18 22:11 [PATCH 1/2] Keep track of original clocksource frequency john stultz
2008-03-18 22:13 ` [PATCH 2/2] Introduce CLOCK_MONOTONIC_RAW john stultz
2008-03-19  2:43   ` Andrew Morton
2008-03-19  3:01     ` john stultz
2008-04-02 11:39   ` [PATCH 1/2] Introduce clocksource_forward_now Roman Zippel
2008-04-02 16:01     ` John Stultz
2008-04-03 21:07     ` Andrew Morton [this message]
2008-04-02 11:50   ` [PATCH 2/2] Introduce CLOCK_MONOTONIC_RAW Roman Zippel
2008-04-02 16:01     ` John Stultz
2008-04-02 16:37       ` Roman Zippel
2008-04-03 21:11     ` Andrew Morton
2008-04-02 11:20 ` [PATCH 1/2] Keep track of original clocksource frequency Roman Zippel
2008-04-02 15:38   ` John Stultz

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=20080403140732.9f30a501.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /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 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.