lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 9 Sep 2009 22:25:52 +0800
From:	Yong Zhang <yong.zhang0@...il.com>
To:	ye janboe <janboe.ye@...il.com>
Cc:	johnstul@...ibm.com, zippel@...ux-m68k.org,
	akpm@...ux-foundation.org, mingo@...e.hu,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] update clocksource raw_time in timekeeping_suspend

On Wed, Sep 9, 2009 at 3:35 PM, ye janboe<janboe.ye@...il.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@...il.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@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ