mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ye janboe <janboe.ye@gmail.com>
To: Yong Zhang <yong.zhang0@gmail.com>
Cc: johnstul@us.ibm.com, zippel@linux-m68k.org,
	akpm@linux-foundation.org, mingo@elte.hu,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] update clocksource raw_time in timekeeping_suspend
Date: Thu, 10 Sep 2009 06:32:33 +0800	[thread overview]
Message-ID: <af3ea28a0909091532v76bab801k15c2db0f68fafc7c@mail.gmail.com> (raw)
In-Reply-To: <2674af740909090725l5862dc95o7cc7236ebc66ad83@mail.gmail.com>

Thanks, Yong Zhang

But I do not think so. From the comments in commit
2d42244ae71d6c7b0884b5664cf2eda30fb2ae68, MONOTONIC_RAW want to give
users access to purely hardware based time.


2009/9/9 Yong Zhang <yong.zhang0@gmail.com>:
> On Wed, Sep 9, 2009 at 3:35 PM, ye janboe<janboe.ye@gmail.com> wrote:
>> after resume from suspend, raw_time is not updated in
>> timekeeping_suspend. CLOCK_MONOTONIC_RAW could not get the real hw
>> time.
>
> It seems that this is not a bug. The design of CLOCK_MONOTONIC_RAW doesn't
> say it will reflect the real hw time. It's just monotonic time which
> is unpoisoned by
> ntp.
>
> Cheers,
> Yong
>
>> This patch fix this issue.
>>
>> Signed-off-by: janboe <janboe.ye@gmail.com>
>> ---
>>  kernel/time/timekeeping.c |    6 ++++++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
>> index e8c77d9..8420b85 100644
>> --- a/kernel/time/timekeeping.c
>> +++ b/kernel/time/timekeeping.c
>> @@ -331,6 +331,8 @@ static unsigned long timekeeping_suspend_time;
>>  static int timekeeping_resume(struct sys_device *dev)
>>  {
>>        unsigned long flags;
>> +       s64 nsec;
>> +       cycle_t last_cycle, cycle_delta;
>>        unsigned long now = read_persistent_clock();
>>
>>        clocksource_resume();
>> @@ -346,8 +348,12 @@ static int timekeeping_resume(struct sys_device *dev)
>>        }
>>        update_xtime_cache(0);
>>        /* re-base the last cycle value */
>> +       last_cycle = clock->cycle_last;
>>        clock->cycle_last = 0;
>>        clock->cycle_last = clocksource_read(clock);
>> +       cycle_delta = clock->cycle_last - last_cycle;
>> +       nsec = cyc2ns(clock, cycle_delta);
>> +       timespec_add_ns(&clock->raw_time, nsec);
>>        clock->error = 0;
>>        timekeeping_suspended = 0;
>>        write_sequnlock_irqrestore(&xtime_lock, flags);
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
>>
>

  reply	other threads:[~2009-09-09 22:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-09  7:35 ye janboe
2009-09-09 14:25 ` Yong Zhang
2009-09-09 22:32   ` ye janboe [this message]
2009-09-09 23:07 ` john stultz
2009-09-10  8:07   ` ye janboe
2009-09-10  9:31     ` Yong Zhang
2009-09-10 22:15       ` john stultz
2009-09-11  3:35         ` ye janboe
2009-09-11 18:09           ` 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=af3ea28a0909091532v76bab801k15c2db0f68fafc7c@mail.gmail.com \
    --to=janboe.ye@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=yong.zhang0@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®