From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbbJTTCc (ORCPT ); Tue, 20 Oct 2015 15:02:32 -0400 Received: from smtprelay0091.hostedemail.com ([216.40.44.91]:37496 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750991AbbJTTC3 (ORCPT ); Tue, 20 Oct 2015 15:02:29 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::,RULES_HIT:41:69:355:379:541:599:800:960:973:981:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1535:1544:1593:1594:1605:1711:1730:1747:1777:1792:1981:2194:2199:2282:2393:2553:2559:2562:3138:3139:3140:3141:3142:3622:3653:3865:3867:3868:3870:3871:3872:3873:3874:4321:4605:5007:6117:6119:6261:7514:7875:7903:8660:10004:10848:10967:11026:11232:11473:11657:11658:11914:12043:12296:12438:12517:12519:12555:12740:13148:13230:14096:14097:21080:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:5,LUA_SUMMARY:none X-HE-Tag: rat04_6cc144b5fb70e X-Filterd-Recvd-Size: 5481 Date: Tue, 20 Oct 2015 15:02:26 -0400 From: Steven Rostedt To: Jiri Slaby Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, Frederic Weisbecker Subject: Re: [PATCH 1/1] fentry: x86, cleanup function_hook uses Message-ID: <20151020150226.013839b7@gandalf.local.home> In-Reply-To: <1444135221-13306-1-git-send-email-jslaby@suse.cz> References: <1444135221-13306-1-git-send-email-jslaby@suse.cz> X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 6 Oct 2015 14:40:21 +0200 Jiri Slaby wrote: > Let's define fentry_hook depending on CC_USING_FENTRY and use that > macro all over. This saves some #ifdef's here and there. > > We do not use the old macro function_hook since it is too generic. > Hence we introduce fentry_hook which corresponds to what it is. Actually, I think I like function_hook better that fentry_hook, because mcount is not an fentry. What else do you think could be used as "function_hook"? -- Steve > > Signed-off-by: Jiri Slaby > Cc: Thomas Gleixner > Cc: "H. Peter Anvin" > Cc: > Cc: Steven Rostedt > Cc: Frederic Weisbecker > Cc: Ingo Molnar > --- > arch/x86/include/asm/fentry.h | 14 ++++++++++++++ > arch/x86/include/asm/ftrace.h | 11 ++++------- > arch/x86/kernel/mcount_64.S | 15 +++++---------- > arch/x86/kernel/x8664_ksyms_64.c | 8 ++------ > 4 files changed, 25 insertions(+), 23 deletions(-) > create mode 100644 arch/x86/include/asm/fentry.h > > diff --git a/arch/x86/include/asm/fentry.h b/arch/x86/include/asm/fentry.h > new file mode 100644 > index 000000000000..febe8d272f0f > --- /dev/null > +++ b/arch/x86/include/asm/fentry.h > @@ -0,0 +1,14 @@ > +#ifndef ASM_FENTRY_H > +#define ASM_FENTRY_H > + > +#ifdef CC_USING_FENTRY > +# define fentry_hook __fentry__ > +#else > +# define fentry_hook mcount > +#endif > + > +#ifndef __ASSEMBLY__ > +extern void fentry_hook(void); > +#endif /* __ASSEMBLY__ */ > + > +#endif /* ASM_FENTRY_H */ > diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h > index 24938852db30..dc235b3659da 100644 > --- a/arch/x86/include/asm/ftrace.h > +++ b/arch/x86/include/asm/ftrace.h > @@ -2,11 +2,10 @@ > #define _ASM_X86_FTRACE_H > > #ifdef CONFIG_FUNCTION_TRACER > -#ifdef CC_USING_FENTRY > -# define MCOUNT_ADDR ((unsigned long)(__fentry__)) > -#else > -# define MCOUNT_ADDR ((unsigned long)(mcount)) > -#endif > + > +#include > + > +#define MCOUNT_ADDR ((unsigned long)(fentry_hook)) > #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ > > #ifdef CONFIG_DYNAMIC_FTRACE > @@ -14,9 +13,7 @@ > #endif > > #ifndef __ASSEMBLY__ > -extern void mcount(void); > extern atomic_t modifying_ftrace_code; > -extern void __fentry__(void); > > static inline unsigned long ftrace_call_adjust(unsigned long addr) > { > diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S > index 94ea120fa21f..ac8d5296d6ec 100644 > --- a/arch/x86/kernel/mcount_64.S > +++ b/arch/x86/kernel/mcount_64.S > @@ -6,6 +6,7 @@ > > #include > #include > +#include > #include > > > @@ -15,12 +16,6 @@ > > #ifdef CONFIG_FUNCTION_TRACER > > -#ifdef CC_USING_FENTRY > -# define function_hook __fentry__ > -#else > -# define function_hook mcount > -#endif > - > /* All cases save the original rbp (8 bytes) */ > #ifdef CONFIG_FRAME_POINTER > # ifdef CC_USING_FENTRY > @@ -147,9 +142,9 @@ > > #ifdef CONFIG_DYNAMIC_FTRACE > > -ENTRY(function_hook) > +ENTRY(fentry_hook) > retq > -END(function_hook) > +END(fentry_hook) > > ENTRY(ftrace_caller) > /* save_mcount_regs fills in first two parameters */ > @@ -258,7 +253,7 @@ END(ftrace_regs_caller) > > #else /* ! CONFIG_DYNAMIC_FTRACE */ > > -ENTRY(function_hook) > +ENTRY(fentry_hook) > cmpq $ftrace_stub, ftrace_trace_function > jnz trace > > @@ -283,7 +278,7 @@ trace: > restore_mcount_regs > > jmp fgraph_trace > -END(function_hook) > +END(fentry_hook) > #endif /* CONFIG_DYNAMIC_FTRACE */ > #endif /* CONFIG_FUNCTION_TRACER */ > > diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c > index a0695be19864..5607abc110c7 100644 > --- a/arch/x86/kernel/x8664_ksyms_64.c > +++ b/arch/x86/kernel/x8664_ksyms_64.c > @@ -10,15 +10,11 @@ > #include > #include > #include > -#include > +#include > > #ifdef CONFIG_FUNCTION_TRACER > /* mcount and __fentry__ are defined in assembly */ > -#ifdef CC_USING_FENTRY > -EXPORT_SYMBOL(__fentry__); > -#else > -EXPORT_SYMBOL(mcount); > -#endif > +EXPORT_SYMBOL(fentry_hook); > #endif > > EXPORT_SYMBOL(__get_user_1);