Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1516360

Re: [PATCH] percpu: use notrace variant of preempt_disable/preempt_enable

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [PATCH] percpu: use notrace variant of preempt_disable/preempt_enable
Date 2016-11-07 18:30 +0100
Message-ID <sAVU5-6hX-15@gated-at.bofh.it> (permalink)
References <szqIG-4zR-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 3 Nov 2016 14:58:38 +0100
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

> Commit 345ddcc882d8 ("ftrace: Have set_ftrace_pid use the bitmap like
> events do") added a couple of this_cpu_read calls to the ftrace code.
> 
> On x86 this is not a problem, since it has single instructions to read
> percpu data. Other architectures which use the generic variant now
> have additional preempt_disable and preempt_enable calls in the core
> ftrace code. This may lead to recursive calls and in result to a dead
> machine, e.g. if preemption and debugging options are enabled.
> 
> To fix this use the notrace variant of preempt_disable and
> preempt_enable within the generic percpu code.
> 
> Reported-and-bisected-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
> Tested-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
> Fixes: 345ddcc882d8 ("ftrace: Have set_ftrace_pid use the bitmap like events do")
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

Acked-by: Steven Rostedt <rostedt@goodmis.org>

Feel free to push this in your tree.

-- Steve

> ---
>  include/asm-generic/percpu.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
> index 40e887068da2..0504ef8f3aa3 100644
> --- a/include/asm-generic/percpu.h
> +++ b/include/asm-generic/percpu.h
> @@ -118,9 +118,9 @@ do {									\
>  #define this_cpu_generic_read(pcp)					\
>  ({									\
>  	typeof(pcp) __ret;						\
> -	preempt_disable();						\
> +	preempt_disable_notrace();					\
>  	__ret = raw_cpu_generic_read(pcp);				\
> -	preempt_enable();						\
> +	preempt_enable_notrace();					\
>  	__ret;								\
>  })
>  

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] percpu: use notrace variant of preempt_disable/preempt_enable Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-11-03 15:00 +0100
  Re: [PATCH] percpu: use notrace variant of  preempt_disable/preempt_enable Steven Rostedt <rostedt@goodmis.org> - 2016-11-07 18:30 +0100
    Re: [PATCH] percpu: use notrace variant of  preempt_disable/preempt_enable Martin Schwidefsky <schwidefsky@de.ibm.com> - 2016-11-08 11:00 +0100

csiph-web