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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a4591ed8-37e3-37f3-13e6-f067d93cbb25@infradead.org>
Date:   Tue, 25 Jun 2019 09:14:02 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     "Jason A. Donenfeld" <Jason@...c4.com>,
        linux-kernel@...r.kernel.org
Cc:     Arnd Bergmann <arnd@...db.de>, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 1/2] timekeeping: add missing non-_ns functions for fast
 accessors

On 6/25/19 1:19 AM, Jason A. Donenfeld wrote:
> Previously there was no analogue to get proper ktime_t versions of the
> fast variety of ktime invocations. This commit makes the interface
> uniform with the other accessors.
> 
> Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
> Cc: Arnd Bergmann <arnd@...db.de>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> ---
>  Documentation/core-api/timekeeping.rst |  7 +++-
>  include/linux/timekeeping.h            | 28 ++++++++++++--
>  kernel/time/timekeeping.c              | 52 +++++++++++++-------------
>  3 files changed, 55 insertions(+), 32 deletions(-)
> 

Hi,
There are a few minor documentation problems here.  See below.

> diff --git a/Documentation/core-api/timekeeping.rst b/Documentation/core-api/timekeeping.rst
> index 20ee447a50f3..29d38a86faac 100644
> --- a/Documentation/core-api/timekeeping.rst
> +++ b/Documentation/core-api/timekeeping.rst
> @@ -94,7 +94,7 @@ different format depending on what is required by the user:
>  	down the seconds to the full seconds of the last timer tick
>  	using the respective reference.
>  
> -Coarse and fast_ns access
> +Coarse and fast access
>  -------------------------

The "underline ---" length should match the heading length.

>  
>  Some additional variants exist for more specialized cases:

> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index d911c8470149..db0081a14b90 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c

> @@ -497,47 +496,46 @@ EXPORT_SYMBOL_GPL(ktime_get_raw_fast_ns);
>   * partially updated.  Since the tk->offs_boot update is a rare event, this
>   * should be a rare occurrence which postprocessing should be able to handle.
>   */
> -u64 notrace ktime_get_boot_fast_ns(void)
> +ktime_t notrace ktime_get_boottime_fast(void)
>  {
>  	struct timekeeper *tk = &tk_core.timekeeper;
>  
> -	return (ktime_get_mono_fast_ns() + ktime_to_ns(tk->offs_boot));
> +	return ktime_add(ktime_get_mono_fast(), tk->offs_boot);
>  }
> -EXPORT_SYMBOL_GPL(ktime_get_boot_fast_ns);
> +EXPORT_SYMBOL_GPL(ktime_get_boottime_fast);
>  
>  
>  /*
> - * See comment for __ktime_get_fast_ns() vs. timestamp ordering
> + * See comment for __ktime_get_fast() vs. timestamp ordering
>   */
> -static __always_inline u64 __ktime_get_real_fast_ns(struct tk_fast *tkf)
> +static __always_inline ktime_t __ktime_get_real_fast(struct tk_fast *tkf)
>  {
>  	struct tk_read_base *tkr;
>  	unsigned int seq;
> -	u64 now;
> +	ktime_t now;
>  
>  	do {
>  		seq = raw_read_seqcount_latch(&tkf->seq);
>  		tkr = tkf->base + (seq & 0x01);
> -		now = ktime_to_ns(tkr->base_real);
> -
> -		now += timekeeping_delta_to_ns(tkr,
> +		now = ktime_add_ns(tkr->base_real,
> +			timekeeping_delta_to_ns(tkr,
>  				clocksource_delta(
>  					tk_clock_read(tkr),
>  					tkr->cycle_last,
> -					tkr->mask));
> +					tkr->mask)));
>  	} while (read_seqcount_retry(&tkf->seq, seq));
>  
>  	return now;
>  }
>  
>  /**
> - * ktime_get_real_fast_ns: - NMI safe and fast access to clock realtime.
> + * ktime_get_real_fast: - NMI safe and fast access to clock realtime.

The function name line should not contain a ':' character.
(I know, you didn't change that.)

>   */
> -u64 ktime_get_real_fast_ns(void)
> +ktime_t ktime_get_real_fast(void)
>  {
> -	return __ktime_get_real_fast_ns(&tk_fast_mono);
> +	return __ktime_get_real_fast(&tk_fast_mono);
>  }
> -EXPORT_SYMBOL_GPL(ktime_get_real_fast_ns);
> +EXPORT_SYMBOL_GPL(ktime_get_real_fast);
>  
>  /**
>   * halt_fast_timekeeper - Prevent fast timekeeper from accessing clocksource.
> 

thnx.
-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ