Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753022AbbBMFwg (ORCPT ); Fri, 13 Feb 2015 00:52:36 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:45540 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752085AbbBMFwK (ORCPT ); Fri, 13 Feb 2015 00:52:10 -0500 From: Wang Nan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , Subject: [RFC PATCH v3 10/26] ftrace: x86: try to fix ftrace when ftrace_replace_code. Date: Fri, 13 Feb 2015 13:40:41 +0800 Message-ID: <1423806041-61907-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1423805941-61407-1-git-send-email-wangnan0@huawei.com> References: <1423805941-61407-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.247] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1237 Lines: 42 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 --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/