Re: [RFC][PATCH 0/4] ftrace: Use -mfentry when supported (this isfor x86_64 right now)

From: Steven Rostedt
Date: Fri Feb 18 2011 - 18:03:10 EST


On Fri, 2011-02-18 at 14:45 -0800, H. Peter Anvin wrote:

> We should also be able to use the breakpoint hack to avoid holding all
> the CPUs. They still need to be interrupted, but that skips the
> rendezvous operation.

As this is about the ftrace code, I'm in the process of analyzing and
updating how the function tracer works. I can look to see if I can
design it so we don't have to always use stop_machine() if a breakpoint
method is in place.

Basically what is needed is to convert a "nop" into a "call" or maybe
the other way around, safely.

Now is it safe to insert a breakpoint (usually a byte I believe), modify
the rest of the instruction and then replace the breakpoint to the new
code? Since the instruction that is being replaced or the instruction
being added is always a nop, the breakpoint handler needs to do nothing
but return to the location after the nop/call.

Is there any synchronization that needs to be done when doing this? Or
can it just be:

insert_breakpoint();
update_instruction();
remove_breakpoint();

Because we need to do this for 22,000 calls in a row.

-- Steve


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