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, 2 Jan 2013 15:09:42 -0500
From:	Don Zickus <dzickus@...hat.com>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Namhyung Kim <namhyung.kim@....com>,
	Ingo Molnar <mingo@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 1/2] watchdog: Use local_clock for get_timestamp()

On Thu, Dec 27, 2012 at 11:49:44AM +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@....com>
> 
> The get_timestamp() function is always called with current cpu, thus
> using local_clock() would be more appropriate and it makes the code
> shorter and cleaner IMHO.

Seems reasonable.  Can't think of why it wasn't implemented this way to
begin with.  

Acked-by: Don Zickus <dzickus@...hat.com>

> 
> Cc: Don Zickus <dzickus@...hat.com>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  kernel/watchdog.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> index 75a2ab3d0b02..082ca6878a3f 100644
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -112,9 +112,9 @@ static int get_softlockup_thresh(void)
>   * resolution, and we don't need to waste time with a big divide when
>   * 2^30ns == 1.074s.
>   */
> -static unsigned long get_timestamp(int this_cpu)
> +static unsigned long get_timestamp(void)
>  {
> -	return cpu_clock(this_cpu) >> 30LL;  /* 2^30 ~= 10^9 */
> +	return local_clock() >> 30LL;  /* 2^30 ~= 10^9 */
>  }
>  
>  static void set_sample_period(void)
> @@ -132,9 +132,7 @@ static void set_sample_period(void)
>  /* Commands for resetting the watchdog */
>  static void __touch_watchdog(void)
>  {
> -	int this_cpu = smp_processor_id();
> -
> -	__this_cpu_write(watchdog_touch_ts, get_timestamp(this_cpu));
> +	__this_cpu_write(watchdog_touch_ts, get_timestamp());
>  }
>  
>  void touch_softlockup_watchdog(void)
> @@ -195,7 +193,7 @@ static int is_hardlockup(void)
>  
>  static int is_softlockup(unsigned long touch_ts)
>  {
> -	unsigned long now = get_timestamp(smp_processor_id());
> +	unsigned long now = get_timestamp();
>  
>  	/* Warn about unreasonable delays: */
>  	if (time_after(now, touch_ts + get_softlockup_thresh()))
> -- 
> 1.7.11.7
> 
--
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