Prev: [PATCH v2 2/4] splice: direct_splice_actor() should not use pos in sd
Next: Change to invalidate_bdev() may break emergency remount R/O
From: Steven Rostedt on 26 May 2010 10:50 On Wed, 2010-05-26 at 10:48 +0200, monstr(a)monstr.eu wrote: > From: Michal Simek <monstr(a)monstr.eu> > > start/stop_critical_timing function for preemptirqsoff, preemptoff > and irqsoff tracers contains atomic_inc and atomic_dec operations. > > Atomic operations used 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 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 use generic atomic implementation. > > Signed-off-by: Michal Simek <monstr(a)monstr.eu> Acked-by: Steven Rostedt <rostedt(a)goodmis.org> -- Steve > --- > include/asm-generic/atomic.h | 12 ++++++------ > 1 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h > index 058129e..6c190fd 100644 > --- a/include/asm-generic/atomic.h > +++ b/include/asm-generic/atomic.h > @@ -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); > temp = v->counter; > temp += i; > v->counter = temp; > - local_irq_restore(flags); > + raw_local_irq_restore(flags); > > return temp; > } > @@ -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); > temp = v->counter; > temp -= i; > v->counter = temp; > - local_irq_restore(flags); > + raw_local_irq_restore(flags); > > return temp; > } > @@ -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); > *addr &= mask; > - local_irq_restore(flags); > + raw_local_irq_restore(flags); > } > > #define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Andrew Morton on 26 May 2010 13:10 On Wed, 26 May 2010 10:42:43 -0400 Steven Rostedt <rostedt(a)goodmis.org> wrote: > On Wed, 2010-05-26 at 10:48 +0200, monstr(a)monstr.eu wrote: > > From: Michal Simek <monstr(a)monstr.eu> > > > > start/stop_critical_timing function for preemptirqsoff, preemptoff > > and irqsoff tracers contains atomic_inc and atomic_dec operations. > > > > Atomic operations used 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 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 use generic atomic implementation. > > > > Signed-off-by: Michal Simek <monstr(a)monstr.eu> > > Acked-by: Steven Rostedt <rostedt(a)goodmis.org> > Sighed-at-by: me. > > diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h > > index 058129e..6c190fd 100644 > > --- a/include/asm-generic/atomic.h > > +++ b/include/asm-generic/atomic.h > > @@ -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); > > temp = v->counter; > > temp += i; > > v->counter = temp; > > - local_irq_restore(flags); > > + raw_local_irq_restore(flags); > > > > return temp; > > } If a developer looks at atomic_add_return() and asks himself "why did this use raw_local_irq_save()", the only way of answering that question is to go groveling through the git logs, which is a right PITA if you're trying to get some coding work done. Guys, any time you add code which is non-obvious at the raw C level, it *needs* a comment! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Steven Rostedt on 26 May 2010 13:20
On Wed, 2010-05-26 at 10:08 -0700, Andrew Morton wrote: > > If a developer looks at atomic_add_return() and asks himself "why did > this use raw_local_irq_save()", the only way of answering that question > is to go groveling through the git logs, which is a right PITA if > you're trying to get some coding work done. > > Guys, any time you add code which is non-obvious at the raw C level, it > *needs* a comment! Totally agree! I've gotten pretty good at adding comments to changes like this that I do. I need to get better at telling others to comment their work ;-) -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |