Prev: [PATCH] timer_list: remove alignment padding on 64 bit when CONFIG_TIMER_STATS
Next: Why is next changing constantly?
From: Michal Simek on 26 Jul 2010 05:00 Andrew Morton wrote: > 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! Andrew: Can you please add this patch to your tree? I have it in microblaze next branch but should go through different tree. Thanks, Michal -- Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian
From: Michal Simek on 28 Jul 2010 01:30 Andrew Morton wrote: > On Mon, 26 Jul 2010 10:49:50 +0200 > Michal Simek <monstr(a)monstr.eu> wrote: > >> 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. > > Seems that this will also affect blackfin, mn10300 and score. I guess > they aren't supporting tracing yet? If they uses asm-generic/atomic.h, then yes. It seems to me that Blackfin uses own asm/atomic.h. nm10300 and score are the same case as Microblaze. In include/linux/irqflags.h is written this commentary. /* * The local_irq_*() APIs are equal to the raw_local_irq*() * if !TRACE_IRQFLAGS. */ If architecture doesn't enable TRACE_IRQFLAGS then there is no difference in behavior. If yes and use asm-generic/atomic.h code, then IRQFLAG tracer freeze because it is traced part of irqsoff tracer because of recursion as is describe in patch description. > >> Signed-off-by: Michal Simek <monstr(a)monstr.eu> >> Acked-by: Steven Rostedt <rostedt(a)goodmis.org> >> Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org> > > hm, I wonder how my signoff got there. Doesn't matter. http://lkml.org/lkml/2010/5/26/364 Michal -- Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian -- 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: Michal Simek on 28 Jul 2010 01:30
Mike Frysinger wrote: > On Tue, Jul 27, 2010 at 19:18, Andrew Morton wrote: >> On Mon, 26 Jul 2010 10:49:50 +0200 Michal Simek wrote: >>> 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. >> Seems that this will also affect blackfin, mn10300 and score. I guess >> they aren't supporting tracing yet? > > do you mean TRACE_IRQFLAGS_SUPPORT ? Blackfin should ... my > understanding was that arches just needed to implement asm/irqflags.h > for it. Blackin uses own include/asm/atomic.h implementation where shouldn't be a problem with irqflags tracer. Look at my second post. Michal -- Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian -- 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/ |