Commit 9e58143dc08123c22c5b9f782b2913bd3a07a03d

Authored by Michal Simek
Committed by Linus Torvalds
1 parent fa260c00c1

asm-generic: use raw_local_irq_save/restore instead local_irq_save/restore

The start/stop_critical_timing functions for preemptirqsoff, preemptoff
and irqsoff tracers contain atomic_inc() and atomic_dec() operations.

Atomic operations use local_irq_save/restore macros to ensure atomic
access but they are traced by the same function which is causing recursion
problem.

The reason is when these tracers are turn ON then the
local_irq_save/restore macros are changed in include/linux/irqflags.h to
call trace_hardirqs_on/off which call start/stop_critical_timing.

Microblaze was affected because it uses generic atomic implementation.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 6 additions and 6 deletions Side-by-side Diff

include/asm-generic/atomic.h
... ... @@ -57,11 +57,11 @@
57 57 unsigned long flags;
58 58 int temp;
59 59  
60   - local_irq_save(flags);
  60 + raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
61 61 temp = v->counter;
62 62 temp += i;
63 63 v->counter = temp;
64   - local_irq_restore(flags);
  64 + raw_local_irq_restore(flags);
65 65  
66 66 return temp;
67 67 }
68 68  
... ... @@ -78,11 +78,11 @@
78 78 unsigned long flags;
79 79 int temp;
80 80  
81   - local_irq_save(flags);
  81 + raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
82 82 temp = v->counter;
83 83 temp -= i;
84 84 v->counter = temp;
85   - local_irq_restore(flags);
  85 + raw_local_irq_restore(flags);
86 86  
87 87 return temp;
88 88 }
89 89  
... ... @@ -135,9 +135,9 @@
135 135 unsigned long flags;
136 136  
137 137 mask = ~mask;
138   - local_irq_save(flags);
  138 + raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
139 139 *addr &= mask;
140   - local_irq_restore(flags);
  140 + raw_local_irq_restore(flags);
141 141 }
142 142  
143 143 #define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))