Skip to content

Commit

Permalink
asm-generic: use raw_local_irq_save/restore instead local_irq_save/re…
Browse files Browse the repository at this point in the history
…store

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>
  • Loading branch information
Michal Simek authored and Linus Torvalds committed Aug 10, 2010
1 parent fa260c0 commit 9e58143
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/asm-generic/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ static inline int atomic_add_return(int i, atomic_t *v)
unsigned long flags;
int temp;

local_irq_save(flags);
raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
temp = v->counter;
temp += i;
v->counter = temp;
local_irq_restore(flags);
raw_local_irq_restore(flags);

return temp;
}
Expand All @@ -78,11 +78,11 @@ static inline int atomic_sub_return(int i, atomic_t *v)
unsigned long flags;
int temp;

local_irq_save(flags);
raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
temp = v->counter;
temp -= i;
v->counter = temp;
local_irq_restore(flags);
raw_local_irq_restore(flags);

return temp;
}
Expand Down Expand Up @@ -135,9 +135,9 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
unsigned long flags;

mask = ~mask;
local_irq_save(flags);
raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
*addr &= mask;
local_irq_restore(flags);
raw_local_irq_restore(flags);
}

#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
Expand Down

0 comments on commit 9e58143

Please sign in to comment.