[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: [PATCH 3/3] ring-buffer: make cpu buffer entries counter atomic
From:       Ingo Molnar <mingo () elte ! hu>
Date:       2009-05-01 16:20:53
Message-ID: 20090501162053.GA17915 () elte ! hu
[Download RAW message or body]


* Steven Rostedt <rostedt@goodmis.org> wrote:

> 
> On Fri, 1 May 2009, Steven Rostedt wrote:
> 
> > 
> > On Fri, 1 May 2009, Ingo Molnar wrote:
> > 
> > > 
> > > * Steven Rostedt <rostedt@goodmis.org> wrote:
> > > 
> > > > From: Steven Rostedt <srostedt@redhat.com>
> > > > 
> > > > The entries counter in cpu buffer is not atomic. Although it only 
> > > > gets updated by a single CPU, interrupts may come in and update 
> > > > the counter too. This would cause missing entries to be added.
> > > 
> > > > -	unsigned long			entries;
> > > > +	atomic_t			entries;
> > > 
> > > Hm, that's not really good as atomics can be rather expensive and 
> > > this is the fastpath.
> > 
> > Actually, it could be local_t. I used that in a lot of the other places.
> > The race is with on CPU not other CPUs, and on archs like x86 there
> > is not cost of the "LOCK".
> 
> Ug, it must be atomic_t. It is also modified by the reader. Thus 
> it is not only a race with a single CPU but also multiple CPUs.
> 
> This means that interrupts disabled is not the only proctection it 
> needs. It must either be an atomic, or protected by a spinlock.

Trace buffers are rather fundamentally per cpu. Where's the problem?

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

Configure | About | News | Add a list | Sponsored by KoreLogic