[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0811131219250.23751@gandalf.stny.rr.com>
Date: Thu, 13 Nov 2008 12:21:00 -0500 (EST)
From: Steven Rostedt <rostedt@...dmis.org>
To: Andi Kleen <andi@...stfloor.org>
cc: Frédéric Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...e.hu>,
Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] tracing/function-return-tracer: Make the function
return tracer lockless
On Thu, 13 Nov 2008, Andi Kleen wrote:
> > > local register i
> > > i = index;
> > > write to index'ed array using i
> > > <--------- interrupt here would overwrite data
> > > ...
> > > index = i + 1;
> >
> >
> > Yes in the common case that would be a danger. But here, if an
> > interrupt is raised, it will increment
> > the counter and then decrement it at return time without dropping the
> > cpu. So after the interrupt, the
> > value will remain the same...
>
> The buffer contents will not be necessarily
> the same. See the scenario above. The interrupt would use the
> same i as the current function and would overwrite the
> partially written entry.
So the answer to this is:
i = index++;
barrier();
write to index i (not index);
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists