Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755823AbbBLM2q (ORCPT ); Thu, 12 Feb 2015 07:28:46 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:21347 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755799AbbBLM2o (ORCPT ); Thu, 12 Feb 2015 07:28:44 -0500 From: Wang Nan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , Subject: [RFC PATCH v2 08/26] ftrace: enable other subsystems make ftrace nop before ftrace_init() Date: Thu, 12 Feb 2015 20:19:51 +0800 Message-ID: <1423743591-12353-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1423743476-11927-1-git-send-email-wangnan0@huawei.com> References: <1423743476-11927-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 X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.54DC9C01.0224,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: cecfd7d43b6cfce314c0573ab6862200 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1690 Lines: 59 Signed-off-by: Wang Nan --- include/linux/ftrace.h | 5 +++++ kernel/trace/ftrace.c | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 8db315a..d37ccd8a 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -702,9 +702,14 @@ static inline void __ftrace_enabled_restore(int enabled) #ifdef CONFIG_FTRACE_MCOUNT_RECORD extern void ftrace_init(void); extern void ftrace_init_early(void); +extern int ftrace_process_loc_early(unsigned long ip); #else static inline void ftrace_init(void) { } static inline void ftrace_init_early(void) { } +static inline int ftrace_process_loc_early(unsigned long __unused) +{ + return 0; +} #endif /* diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 79b3e88..150762a 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5028,6 +5028,21 @@ void __init ftrace_init_early(void) ftrace_sort_mcount_area(); } +int __init ftrace_process_loc_early(unsigned long addr) +{ + unsigned long ip = ftrace_location(addr); + struct dyn_ftrace fake_rec; + int ret; + + if (ip != addr) + return -EINVAL; + + memset(&fake_rec, '\0', sizeof(fake_rec)); + fake_rec.ip = ip; + ret = ftrace_make_nop(NULL, &fake_rec, MCOUNT_ADDR); + return ret; +} + /* Do nothing if arch does not support this */ void __weak arch_ftrace_update_trampoline(struct ftrace_ops *ops) { -- 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/