Re: [PATCH] tracing: move static old_tracer to trace_iterator

From: Frederic Weisbecker
Date: Sat Jan 30 2010 - 17:48:13 EST

On Tue, Jan 26, 2010 at 03:28:13PM +0800, Lai Jiangshan wrote:
> static old_tracer is global for all processes.
> So there is a potential bug when:
> current_trace and static old_tracer are changed by other processes,
> current_trace and static old_tracer are match with each other.
> but *iter->trace and *current_trace are not match.
> This patch move old_tracer to trace_iterator, and make it not global.
> Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>

We should actually get rid of old_tracer and have iter->trace
to be a pointer so that the check can be summarized with

if (iter->trace != current_trace)

I don't exactly recall why we've made iter->trace a copy
of the current_trace. I remember I did it this uglyness,
but I don't remember exactly why. Probably for bad reasons
that should be fixed another way.

Ok, having a deeper look, I think it was because some tracers
implement callbacks whereas others may not, so the

if (iter->trace->splice_read)
ret = iter->trace->splice_read(...)

would be racy if we weren't copying current_trace.

To fix this, I would rather try to ensure every tracers
have stub callbacks for those unimplemented. This is going
to be much proper than this dance between current_tracer,
old_tracer and iter->trace.

What do you think?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at