Re: lockdep: possible reason: unannotated irqs-off. (was: Re:Linux 2.6.38-rc4)

From: Peter Zijlstra
Date: Tue Feb 08 2011 - 08:47:24 EST


On Tue, 2011-02-08 at 21:34 +0800, Yong Zhang wrote:
> On Tue, Feb 08, 2011 at 08:11:08PM +0800, Yong Zhang wrote:
> > From: Yong Zhang <yong.zhang0@xxxxxxxxx>
> > Subject: [PATCH 1/2] softirq: introduce loacal_bh_enable_force_wake()
> >
> > If there is pending softirq, don't handle it in the caller's
> > context, invoke ksoftirqd directly instead.
> >
> > del_timer_sync() will be the first caller.
> >
> > Signed-off-by: Yong Zhang <yong.zhang0@xxxxxxxxx>
> > Cc: Ingo Molnar <mingo@xxxxxxx>
> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > ---
> > include/linux/bottom_half.h | 1 +
> > kernel/softirq.c | 21 +++++++++++++++------
> > 2 files changed, 16 insertions(+), 6 deletions(-)
> >
> > diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h
> > index 27b1bcf..665d697 100644
> > --- a/include/linux/bottom_half.h
> > +++ b/include/linux/bottom_half.h
> > @@ -5,5 +5,6 @@ extern void local_bh_disable(void);
> > extern void _local_bh_enable(void);
> > extern void local_bh_enable(void);
> > extern void local_bh_enable_ip(unsigned long ip);
> > +extern void local_bh_enable_force_wake(void);
> >
> > #endif /* _LINUX_BH_H */
> > diff --git a/kernel/softirq.c b/kernel/softirq.c
> > index 68eb5ef..3c05dfa 100644
> > --- a/kernel/softirq.c
> > +++ b/kernel/softirq.c
> > @@ -154,9 +154,9 @@ void _local_bh_enable(void)
> >
> > EXPORT_SYMBOL(_local_bh_enable);
> >
> > -static inline void _local_bh_enable_ip(unsigned long ip)
> > +static inline void _local_bh_enable_ip(unsigned long ip, bool force_wake)
> > {
> > - WARN_ON_ONCE(in_irq() || irqs_disabled());
> > + WARN_ON_ONCE(in_irq() || (!force_wake && irqs_disabled()));
>
> Only suppressing the warning is not enough here :(
>
> > #ifdef CONFIG_TRACE_IRQFLAGS
> > local_irq_disable();
>
>
> The semantic "called with irqs_disabled" is showed on several place
> of _local_bh_enable_ip().
>
> Need more thinking about it...

Well that and modifying softirq bits for a lockdep annotation really
feels wrong.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/