[RFC PATCH v3 10/26] ftrace: x86: try to fix ftrace when ftrace_replace_code.
From: Wang Nan
Date: Fri Feb 13 2015 - 00:52:40 EST
For ftrace x86, when ftrace_replace_code(), if it failed to add
breakpoint, trigger a bugfix trying instead of ftrace_bug().
Only give one chance for fixing at add_breakpoints(). If it fails at
other stage, bug directly.
Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
---
arch/x86/kernel/ftrace.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 7bdba65..c869138 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -553,8 +553,16 @@ void ftrace_replace_code(int enable)
rec = ftrace_rec_iter_record(iter);
ret = add_breakpoints(rec, enable);
- if (ret)
- goto remove_breakpoints;
+ if (ret) {
+ /*
+ * Don't trigger ftrace_bug here. Let it done by
+ * remove_breakpoints procedure.
+ */
+ ret = __ftrace_tryfix_bug(ret, enable, rec,
+ add_breakpoints(rec, enable), false);
+ if (ret)
+ goto remove_breakpoints;
+ }
count++;
}
--
1.8.4
--
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/