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: <1375811455.25420.39.camel@gandalf.local.home>
Date:	Tue, 06 Aug 2013 13:50:55 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Christoph Lameter <cl@...two.org>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: x86: use this_cpu for debug_stack_usage

On Tue, 2013-08-06 at 17:01 +0000, Christoph Lameter wrote:
> Reduces overhead a bit and frees up a couple of registers.
> 
> Signed-off-by: Christoph Lameter <cl@...ux.com>
> 
> Index: linux/arch/x86/include/asm/debugreg.h
> ===================================================================
> --- linux.orig/arch/x86/include/asm/debugreg.h	2013-07-30 14:00:30.000000000 -0500
> +++ linux/arch/x86/include/asm/debugreg.h	2013-07-30 14:00:57.503076270 -0500
> @@ -97,11 +97,11 @@ extern void hw_breakpoint_restore(void);
>  DECLARE_PER_CPU(int, debug_stack_usage);
>  static inline void debug_stack_usage_inc(void)
>  {
> -	__get_cpu_var(debug_stack_usage)++;
> +	__this_cpu_inc(debug_stack_usage);

I don't remember why I didn't use this in the first place. Perhaps I was
still in the "get_cpu" mind set.

Also, what's the difference between "__this_cpu_inc()" and
"this_cpu_inc()"?

>  }
>  static inline void debug_stack_usage_dec(void)
>  {
> -	__get_cpu_var(debug_stack_usage)--;
> +	__this_cpu_dec(debug_stack_usage);
>  }
>  int is_debug_stack(unsigned long addr);
>  void debug_stack_set_zero(void);

Might as well change is_debug_stack() to use __this_cpu_read() instead
of __get_cpu_var().

-- Steve


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