Messages in this thread | | | Subject | Re: ftrace performance impact with different configuration | From | Steven Rostedt <> | Date | Fri, 30 Dec 2011 17:25:41 -0500 |
| |
On Fri, 2011-12-30 at 14:07 +0100, Philippe Rétornaz wrote:
> Sorry about being a bit naive, but why it is not possible to do it in two > steps ? > call stop_machine to put the jmp which skip the call to mcount > Then wait until all tasks hits schedule() (synchronize_sched() ?)
Here's the problem. With a preemptible kernel, hitting schedule() does not mean that you can guarantee that all tasks have not been interrupted.
nop (use to be push lr) ------------> interrupt set NEED_RESCHED end of interrupt preempt_schedule() schedule()
[ another processes is now running ] call stop_machine() put in push lr call stop_machine() put in call to mcount
everything seems to be running fine.
the low priority task gets scheduled again...
schedule() finishes preempt_schedule() finishes back at tail of return_from_intr in entry_64.S iret call mcount pop lr (which was never pushed) jmp lr
Now we jump back to some random stuff and the stack is corrupted.
There's no way to safely modify two instructions that depend on each other in a preemptible kernel, with the exception of waiting for all CPUs to hit idle (which may never happen on a busy system). And even that may be racy.
-- Steve
> Then modify both instructions to put in place the two nops since we know that > nobody is calling mcount.
-- 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/
| |