[RFC PATCH v3 10/26] ftrace: x86: try to fix ftrace when ftrace_replace_code.

Wang Nan wangnan0 at huawei.com
Thu Feb 12 21:40:41 PST 2015


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 at huawei.com>
---
 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




More information about the linux-arm-kernel mailing list