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:	Thu, 22 Jan 2015 10:30:57 -0800
From:	John Stultz <john.stultz@...aro.org>
To:	Xunlei Pang <pang.xunlei@...aro.org>
Cc:	lkml <linux-kernel@...r.kernel.org>,
	"rtc-linux@...glegroups.com" <rtc-linux@...glegroups.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Alessandro Zummo <a.zummo@...ertech.it>,
	Arnd Bergmann <arnd.bergmann@...aro.org>
Subject: Re: [PATCH v2 1/3] time: Don't bother to run rtc_resume() for the
 nonstop clocksource

On Thu, Jan 22, 2015 at 4:01 AM, Xunlei Pang <pang.xunlei@...aro.org> wrote:
> If a system does not provide a persistent_clock(), the time
> will be updated on resume by rtc_resume(). With the addition
> of the non-stop clocksources for suspend timing, those systems
> set the time on resume in timekeeping_resume(), but may not
> provide a valid persistent_clock().
>
> This results in the rtc_resume() logic thinking no one has set
> the time and it then will over-write the suspend time again,
> which is not necessary and only increases clock error.
>
> So, fix this for rtc_resume().
>
> Signed-off-by: Xunlei Pang <pang.xunlei@...aro.org>
> ---
> v1->v2:
> Modify according to Thomas' feedback.
>
>  drivers/rtc/class.c         |  2 +-
>  include/linux/timekeeping.h |  7 +++++++
>  kernel/time/timekeeping.c   | 16 +++++-----------
>  3 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
> index 472a5ad..6100af5 100644
> --- a/drivers/rtc/class.c
> +++ b/drivers/rtc/class.c
> @@ -102,7 +102,7 @@ static int rtc_resume(struct device *dev)
>         struct timespec64       sleep_time;
>         int err;
>
> -       if (has_persistent_clock())
> +       if (timekeeping_sleeptime_injected())
>                 return 0;
>
>         rtc_hctosys_ret = -ENODEV;
> diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
> index 9b63d13..2b87c64 100644
> --- a/include/linux/timekeeping.h
> +++ b/include/linux/timekeeping.h
> @@ -238,6 +238,13 @@ extern void getnstime_raw_and_real(struct timespec *ts_raw,
>   */
>  extern bool persistent_clock_exist;
>  extern int persistent_clock_is_local;
> +extern bool timekeeping_sleeptime_inject;
> +
> +/* Used by rtc_resume() */
> +static inline bool timekeeping_sleeptime_injected(void)
> +{
> +       return timekeeping_sleeptime_inject;
> +}
>

Again, there's no reason to make this a static inline, nor the
sleeptime_inject variable global.
Just make it a function in timekeeping and provide definition so it
can be used by the rtc resume.

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