Messages in this thread | | | Date | Fri, 6 Feb 2009 14:49:02 -0500 (EST) | From | Steven Rostedt <> | Subject | Re: [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
| |