lkml.org 
[lkml]   [2009]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/7] ring-buffer: add NMI protection for spinlocks

On Fri, 6 Feb 2009, Mathieu Desnoyers wrote:
> >
> > commit_page = cpu_buffer->commit_page;
> > /* we just need to protect against interrupts */
> > @@ -995,7 +1026,19 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
> > struct buffer_page *next_page = tail_page;
> >
> > local_irq_save(flags);
> > - __raw_spin_lock(&cpu_buffer->lock);
> > + /*
> > + * NMIs can happen after we take the lock.
> > + * If we are in an NMI, only take the lock
> > + * if it is not already taken. Otherwise
> > + * simply fail.
> > + */
> > + if (unlikely(__get_cpu_var(rb_in_nmi))) {
> > + if (!__raw_spin_trylock(&cpu_buffer->lock))
> > + goto out_unlock;
>
> Hi Steven,
>
> You're not silently discarding an event, aren't you ? ;)
>
> Please keep at least a count of "events_lost" so it can be reported
> later by a printk().

I could add a counter here, but it is not a silent discard. The tracer
would receive a "NULL" pointer in this case. Then the tracer can do what
it wants with this information. The ring buffer will never discard data
(otherwise it is a bug) without letting the tracer know that it did so.

-- Steve



\
 
 \ /
  Last update: 2009-02-06 20:51    [W:0.035 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site