From: Ingo Molnar <mingo@elte.hu>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] make CALLER_ADDRx overwriteable
Date: Thu, 26 Feb 2009 04:02:18 +0100 [thread overview]
Message-ID: <20090226030218.GA7526@elte.hu> (raw)
In-Reply-To: <1235594749-24585-1-git-send-email-u.kleine-koenig@pengutronix.de>
* Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> The current definition of CALLER_ADDRx isn't suitable for all platforms.
> E.g. for ARM __builtin_return_address(N) doesn't work for N > 0 and
> AFAIK for powerpc there are no frame pointers needed to have a working
> __builtin_return_address. This patch allows defining the CALLER_ADDRx
> macros in <asm/ftrace.h> and let these take precedence.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> I think I don't break any architecture with this patch:
>
> $ for arch in $(ls arch/); do if test ! -d arch/$arch; then continue; fi; test -f arch/$arch/include/asm/ftrace.h || test -f include/asm-$arch/ftrace.h || { echo -n "$arch: "; git grep FTRACE arch/$arch | wc -l; } done
> alpha: 0
> avr32: 0
> blackfin: 0
> cris: 0
> frv: 0
> h8300: 0
> m32r: 0
> m68k: 0
> m68knommu: 0
> mips: 0
> mn10300: 0
> parisc: 0
> um: 0
> xtensa: 0
>
> So all archs that don't have <asm/ftrace.h> seem not to use FTRACE.
>
> Best regards
> Uwe
>
> include/linux/ftrace.h | 41 +++++++++++++++++++++--------------------
> 1 files changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index 847bb3c..9d8d362 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -11,6 +11,8 @@
> #include <linux/bitops.h>
> #include <linux/sched.h>
>
> +#include <asm/ftrace.h>
> +
> #ifdef CONFIG_FUNCTION_TRACER
>
> extern int ftrace_enabled;
> @@ -103,8 +105,6 @@ struct ftrace_func_command {
> };
>
> #ifdef CONFIG_DYNAMIC_FTRACE
> -/* asm/ftrace.h must be defined for archs supporting dynamic ftrace */
> -#include <asm/ftrace.h>
>
> int ftrace_arch_code_modify_prepare(void);
> int ftrace_arch_code_modify_post_process(void);
> @@ -282,24 +282,25 @@ static inline void __ftrace_enabled_restore(int enabled)
> #endif
> }
>
> -#ifdef CONFIG_FRAME_POINTER
> -/* TODO: need to fix this for ARM */
> -# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
> -# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
> -# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
> -# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
> -# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
> -# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
> -# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
> -#else
> -# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
> -# define CALLER_ADDR1 0UL
> -# define CALLER_ADDR2 0UL
> -# define CALLER_ADDR3 0UL
> -# define CALLER_ADDR4 0UL
> -# define CALLER_ADDR5 0UL
> -# define CALLER_ADDR6 0UL
> -#endif
> +#ifndef CALLER_ADDR0
> +# ifdef CONFIG_FRAME_POINTER
> +# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
> +# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
> +# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
> +# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
> +# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
> +# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
> +# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
> +# else
> +# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
> +# define CALLER_ADDR1 0UL
> +# define CALLER_ADDR2 0UL
> +# define CALLER_ADDR3 0UL
> +# define CALLER_ADDR4 0UL
> +# define CALLER_ADDR5 0UL
> +# define CALLER_ADDR6 0UL
> +# endif
> +#endif /* ifndef CALLER_ADDR0 */
Makes sense!
Acked-by: Ingo Molnar <mingo@elte.hu>
Ingo
next parent reply other threads:[~2009-02-26 3:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1235594749-24585-1-git-send-email-u.kleine-koenig@pengutronix.de>
2009-02-26 3:02 ` Ingo Molnar [this message]
2009-02-26 3:13 ` [PATCH] make CALLER_ADDRx overwriteable Steven Rostedt
2009-02-25 22:16 Uwe Kleine-König
2009-02-25 22:20 ` Mike Frysinger
2009-02-25 22:26 ` Uwe Kleine-König
2009-02-26 5:08 ` Steven Rostedt
2009-02-26 13:45 ` Uwe Kleine-König
2009-02-26 13:59 ` Steven Rostedt
2009-02-26 22:11 ` Uwe Kleine-König
2009-02-27 7:32 ` KOSAKI Motohiro
2009-02-27 11:22 ` Uwe Kleine-König
2009-02-27 15:21 ` Steven Rostedt
2009-02-27 20:30 ` Uwe Kleine-König
2009-02-28 6:40 ` KOSAKI Motohiro
2009-02-28 7:25 ` Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090226030218.GA7526@elte.hu \
--to=mingo@elte.hu \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.