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] [day] [month] [year] [list]
Date:   Wed, 9 Feb 2022 15:54:44 -0600
From:   Andrew Halaney <ahalaney@...hat.com>
To:     Mark-PK Tsai <mark-pk.tsai@...iatek.com>
Cc:     rostedt@...dmis.org, matthias.bgg@...il.com,
        akpm@...ux-foundation.org, mhiramat@...nel.org, vbabka@...e.cz,
        wangkefeng.wang@...wei.com, linux@...musvillemoes.dk,
        keescook@...omium.org, valentin.schneider@....com,
        peterz@...radead.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org, yj.chiang@...iatek.com
Subject: Re: [PATCH] init: Use ktime_us_delta() to make initcall_debug log
 more precise

On Wed, Feb 09, 2022 at 01:33:50PM +0800, Mark-PK Tsai wrote:
> Use ktime_us_delta() to make the initcall_debug log more precise than
> right shifting the result of ktime_to_ns() by 10 bits.
> 
> Signed-off-by: Mark-PK Tsai <mark-pk.tsai@...iatek.com>
> ---
>  init/main.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/init/main.c b/init/main.c
> index 65fa2e41a9c0..c8edcc3029b1 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1246,15 +1246,11 @@ trace_initcall_start_cb(void *data, initcall_t fn)
>  static __init_or_module void
>  trace_initcall_finish_cb(void *data, initcall_t fn, int ret)
>  {
> -	ktime_t *calltime = (ktime_t *)data;
> -	ktime_t delta, rettime;
> -	unsigned long long duration;
> +	ktime_t rettime, *calltime = (ktime_t *)data;
>  
>  	rettime = ktime_get();
> -	delta = ktime_sub(rettime, *calltime);
> -	duration = (unsigned long long) ktime_to_ns(delta) >> 10;
>  	printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs\n",
> -		 fn, ret, duration);
> +		 fn, ret, (unsigned long long)ktime_us_delta(rettime, *calltime));
>  }
>  
>  static ktime_t initcall_calltime;
> -- 
> 2.18.0
> 

I took this for a spin while playing around with other things today,
cleans things up nicely imo.

Reviewed-by: Andrew Halaney <ahalaney@...hat.com>
Tested-by: Andrew Halaney <ahalaney@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ