]> Git Repo - linux.git/commitdiff
percpu: use notrace variant of preempt_disable/preempt_enable
authorHeiko Carstens <[email protected]>
Thu, 3 Nov 2016 12:09:24 +0000 (13:09 +0100)
committerMartin Schwidefsky <[email protected]>
Tue, 8 Nov 2016 09:29:44 +0000 (10:29 +0100)
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 <[email protected]>
Tested-by: Sebastian Ott <[email protected]>
Fixes: 345ddcc882d8 ("ftrace: Have set_ftrace_pid use the bitmap like events do")
Signed-off-by: Heiko Carstens <[email protected]>
Acked-by: Steven Rostedt <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
include/asm-generic/percpu.h

index 40e887068da213e595951f16caf8eb7ca83d3179..0504ef8f3aa31d5e7a9f0d86d1cb3fc130fee9e0 100644 (file)
@@ -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;                                                          \
 })
 
This page took 0.057245 seconds and 4 git commands to generate.