[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87od0jd6ds.fsf@basil.nowhere.org>
Date: Thu, 13 Nov 2008 15:53:35 +0100
From: Andi Kleen <andi@...stfloor.org>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] tracing/function-return-tracer: Make the function return tracer lockless
Frederic Weisbecker <fweisbec@...il.com> writes:
O
> _ The only race could happen between the current thread and an interrupt. If an
> interrupt is raised, it will increase the index of the return stack storage and
> then execute until the end of the tracing to finally free the index it used.
> We don't need to disable irqs.
>
> This is theorical. In practice, I've tested it with a two-core SMP and had no
> problem at all. Perhaps -tip testing could confirm it.
The problem I think is that you assume the ++ is atomic against
interrupts, which is not guaranteed by the C compiler. e.g.
it would be perfectly legal for the compiler to generate code like
local register i
i = index;
write to index'ed array using i
<--------- interrupt here would overwrite data
...
index = i + 1;
You would need to convert the index access to a "local_add_return()" and
possibly also add memory barriers.
-Andi
--
ak@...ux.intel.com
--
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