tracing/function-graph-tracer: fix a regression while suspend to disk
authorFrederic Weisbecker <fweisbec@gmail.com>
Wed, 14 Jan 2009 21:33:27 +0000 (13:33 -0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 15 Jan 2009 08:47:40 +0000 (09:47 +0100)
commit4a2b8dda3f8705880ec7408135645602d5590f51
tree94e13c979bd20c5aeb67b1cc5aadf87f8a47b25a
parent0ee6b6cf5bdb793b4c68507dd65adf16341aa4ca
tracing/function-graph-tracer: fix a regression while suspend to disk

Impact: fix a crash while kernel image restore

When the function graph tracer is running and while suspend to disk, some racy
and dangerous things happen against this tracer.

The current task will save its registers including the stack pointer which
contains the return address hooked by the tracer. But the current task will
continue to enter other functions after that to save the memory, and then
it will store other return addresses, and finally loose the old depth which
matches the return address saved in the old stack (during the registers saving).

So on image restore, the code will return to wrong addresses.
And there are other things: on restore, the task will have it's "current"
pointer overwritten during registers restoring....switching from one task to
another... That would be insane to try to trace function graphs at these
stages.

This patch makes the function graph tracer listening on power events, making
it's tracing disabled for the current task (the one that performs the
hibernation work) while suspend/resume to disk, making the tracing safe
during hibernation.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/ftrace.c