lkml.org 
[lkml]   [2009]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch 11/11] ftrace plugin for kernel symbol tracing using HW Breakpoint interfaces - v2

On Sat, 21 Mar 2009, K.Prasad wrote:
> > >
>
> > > +
> > > +void ksym_collect_stats(unsigned long hbkpt_hit_addr)
> > > +{
> > > + struct hlist_node *node;
> > > + struct trace_ksym *entry;
> > > +
> > > + spin_lock(&ksym_stat_lock);
> >
> >
> > I see that can be called from ksym_hbkpt_handler which in turn
> > can be called from interrupt context, right?
> > You can issue a deadlock if you don't disable interrupts here.
> >
> > Thanks,
> > Frederic.
> >
>
> ksym_collect_stats<--ksym_hbkpt_handler<--hw_breakpoint_handler<--do_debug
> invocation happens with interrupts enabled (IF bit is set). I do find
> that a few plugins in kernel/trace enclose the
> trace_buffer_lock_reserve()--trace_buffer_unlock_commit() invocation
> within interrupt-disabled code. Is that a requirement there?
>
> The potential deadlock scenario you foresee isn't obvious to me. Can you
> explain?

Can that lock ever be taken in an interrupt? If not, document that (and
perhaps add a WARN_ON(in_interrupt()); ). Otherwise you have a possible:

spin_lock(&ksym_stat_lock);

===> take interrupt ...

(from interrupt)
spin_lock(&ksym_stat_lock); <== deadlock.


-- Steve



\
 
 \ /
  Last update: 2009-03-21 17:41    [W:0.085 / U:0.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site