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] [day] [month] [year] [list]
Date:	Wed, 11 Mar 2015 08:28:28 -0700
From:	Tony Lindgren <tony@...mide.com>
To:	Xunlei Pang <xlpang@....com>
Cc:	linux-kernel@...r.kernel.org, rtc-linux@...glegroups.com,
	Thomas Gleixner <tglx@...utronix.de>,
	Alessandro Zummo <a.zummo@...ertech.it>,
	John Stultz <john.stultz@...aro.org>,
	Arnd Bergmann <arnd.bergmann@...aro.org>,
	linux-omap@...r.kernel.org, linux-tegra@...r.kernel.org,
	Stephen Warren <swarren@...dotorg.org>, linux390@...ibm.com,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	Arnd Bergmann <arnd@...db.de>,
	Xunlei Pang <pang.xunlei@...aro.org>
Subject: Re: [PATCH 4/8] ARM: OMAP: 32k counter: Provide y2038-safe
 omap_read_persistent_clock() replacement

* Xunlei Pang <xlpang@....com> [150310 20:18]:
> From: Xunlei Pang <pang.xunlei@...aro.org>
> 
> As part of addressing "y2038 problem" for in-kernel uses, this
> patch adds the y2038-safe omap_read_persistent_clock64() using
> timespec64.
> 
> Because we rely on some subsequent changes to convert arm multiarch
> support, omap_read_persistent_clock() will be removed then.
> 
> Also remove the needless spinlock, because read_persistent_clock()
> doesn't run simultaneously.
> 
> Signed-off-by: Xunlei Pang <pang.xunlei@...aro.org>

Looks OK to me:

Acked-by: Tony Lindgren <tony@...mide.com>

> ---
>  arch/arm/plat-omap/counter_32k.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
> index 61b4d70..d422e36 100644
> --- a/arch/arm/plat-omap/counter_32k.c
> +++ b/arch/arm/plat-omap/counter_32k.c
> @@ -44,24 +44,20 @@ static u64 notrace omap_32k_read_sched_clock(void)
>  }
>  
>  /**
> - * omap_read_persistent_clock -  Return time from a persistent clock.
> + * omap_read_persistent_clock64 -  Return time from a persistent clock.
>   *
>   * Reads the time from a source which isn't disabled during PM, the
>   * 32k sync timer.  Convert the cycles elapsed since last read into
> - * nsecs and adds to a monotonically increasing timespec.
> + * nsecs and adds to a monotonically increasing timespec64.
>   */
> -static struct timespec persistent_ts;
> +static struct timespec64 persistent_ts;
>  static cycles_t cycles;
>  static unsigned int persistent_mult, persistent_shift;
> -static DEFINE_SPINLOCK(read_persistent_clock_lock);
>  
> -static void omap_read_persistent_clock(struct timespec *ts)
> +static void omap_read_persistent_clock64(struct timespec64 *ts)
>  {
>  	unsigned long long nsecs;
>  	cycles_t last_cycles;
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&read_persistent_clock_lock, flags);
>  
>  	last_cycles = cycles;
>  	cycles = sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0;
> @@ -69,11 +65,17 @@ static void omap_read_persistent_clock(struct timespec *ts)
>  	nsecs = clocksource_cyc2ns(cycles - last_cycles,
>  					persistent_mult, persistent_shift);
>  
> -	timespec_add_ns(&persistent_ts, nsecs);
> +	timespec64_add_ns(&persistent_ts, nsecs);
>  
>  	*ts = persistent_ts;
> +}
> +
> +static void omap_read_persistent_clock(struct timespec *ts)
> +{
> +	struct timespec64 ts64;
>  
> -	spin_unlock_irqrestore(&read_persistent_clock_lock, flags);
> +	omap_read_persistent_clock64(&ts64);
> +	*ts = timespec64_to_timespec(ts64);
>  }
>  
>  /**
> -- 
> 1.9.1
> 
> 
--
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