* [PATCH] make CALLER_ADDRx overwriteable
@ 2009-02-25 22:16 Uwe Kleine-König
2009-02-25 22:20 ` Mike Frysinger
2009-02-26 5:08 ` Steven Rostedt
0 siblings, 2 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2009-02-25 22:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Steven Rostedt, Peter Zijlstra, Ingo Molnar
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 resent because vger blocked my mail saying: "Wrong MIME labeling on
8-bit character texts." Steven didn't get it either. I don't know
what's wrong, so I put the patch back into git and format-patch'd it. I
hope this one makes it through. Sorry if you got it twice.]
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 */
#ifdef CONFIG_IRQSOFF_TRACER
extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
--
tg: (db50eec..) t/ftrace/make_CALLER_ADDRx_overwriteable (depends on: tip/master)
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
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
1 sibling, 1 reply; 15+ messages in thread
From: Mike Frysinger @ 2009-02-25 22:20 UTC (permalink / raw)
To: Uwe Kleine-König, Bernd Schmidt
Cc: linux-kernel, Steven Rostedt, Peter Zijlstra, Ingo Molnar
On Wed, Feb 25, 2009 at 17:16, Uwe Kleine-König 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
afaik, the same applies to the Blackfin port. we looked at
implementing __builtin_return_address(N) and decided it wasnt worth
the hassle.
-mike
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
2009-02-25 22:20 ` Mike Frysinger
@ 2009-02-25 22:26 ` Uwe Kleine-König
0 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2009-02-25 22:26 UTC (permalink / raw)
To: Mike Frysinger
Cc: Bernd Schmidt, linux-kernel, Steven Rostedt, Peter Zijlstra,
Ingo Molnar
On Wed, Feb 25, 2009 at 05:20:13PM -0500, Mike Frysinger wrote:
> On Wed, Feb 25, 2009 at 17:16, Uwe Kleine-König 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
>
> afaik, the same applies to the Blackfin port. we looked at
> implementing __builtin_return_address(N) and decided it wasnt worth
> the hassle.
I think the same applies for ARM:
http://thread.gmane.org/gmane.comp.gcc.devel/103804
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Strasse 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
[not found] <1235594749-24585-1-git-send-email-u.kleine-koenig@pengutronix.de>
@ 2009-02-26 3:02 ` Ingo Molnar
2009-02-26 3:13 ` Steven Rostedt
0 siblings, 1 reply; 15+ messages in thread
From: Ingo Molnar @ 2009-02-26 3:02 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-kernel, Steven Rostedt, Peter Zijlstra
* 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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
2009-02-26 3:02 ` [PATCH] make CALLER_ADDRx overwriteable Ingo Molnar
@ 2009-02-26 3:13 ` Steven Rostedt
0 siblings, 0 replies; 15+ messages in thread
From: Steven Rostedt @ 2009-02-26 3:13 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Uwe Kleine-König, linux-kernel, Peter Zijlstra
On Thu, 26 Feb 2009, Ingo Molnar wrote:
>
> * 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>
Thanks Ingo,
Uwe, I never got your email (but I can get it from my LKML mail box). I'm
not sure if my ISP blocked you (I've been having issues with Hover.com
ever since they bought out domaindirect.com), or my own email server.
But I'll grab it from LKML and test it out.
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
2009-02-25 22:16 Uwe Kleine-König
2009-02-25 22:20 ` Mike Frysinger
@ 2009-02-26 5:08 ` Steven Rostedt
2009-02-26 13:45 ` Uwe Kleine-König
1 sibling, 1 reply; 15+ messages in thread
From: Steven Rostedt @ 2009-02-26 5:08 UTC (permalink / raw)
To: Uwe Kleine-K??nig; +Cc: linux-kernel, Peter Zijlstra, Ingo Molnar
On Wed, Feb 25, 2009 at 11:16:09PM +0100, Uwe Kleine-K??nig 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 resent because vger blocked my mail saying: "Wrong MIME labeling on
> 8-bit character texts." Steven didn't get it either. I don't know
> what's wrong, so I put the patch back into git and format-patch'd it. I
> hope this one makes it through. Sorry if you got it twice.]
>
> 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.
Ah, but unfortunately this will break other archs :-(
They may not use FTRACE, but they do include the ftrace header (the ftrace.h header
can be used for other types of tracing, not just function tracing).
A better solution would be to move the CALLER_ADDER0 out of the
ftrace.h header completely. Not sure where though. Have a caller.h ?
And then we can have ftrace.h include caller.h. A asm/caller.h can be
used to override the default.
How does that sound?
-- Steve
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
2009-02-26 5:08 ` Steven Rostedt
@ 2009-02-26 13:45 ` Uwe Kleine-König
2009-02-26 13:59 ` Steven Rostedt
0 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2009-02-26 13:45 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-kernel, Peter Zijlstra, Ingo Molnar
Hi Steven,
On Thu, Feb 26, 2009 at 12:08:06AM -0500, Steven Rostedt wrote:
> On Wed, Feb 25, 2009 at 11:16:09PM +0100, Uwe Kleine-K??nig 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>
>
> Ah, but unfortunately this will break other archs :-(
>
> They may not use FTRACE, but they do include the ftrace header (the
> ftrace.h header can be used for other types of tracing, not just
> function tracing).
Then that's from generic files, because the archs that don't have
<asm/ftrace.h> don't include <linus/ftrace.h> under arch/.
> A better solution would be to move the CALLER_ADDER0 out of the
> ftrace.h header completely. Not sure where though. Have a caller.h ?
> And then we can have ftrace.h include caller.h. A asm/caller.h can be
> used to override the default.
Well, but then every arch needs this file. I don't see an advantage
here. So I'd favour to add an empty ftrace.h for the relevant archs.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
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
0 siblings, 1 reply; 15+ messages in thread
From: Steven Rostedt @ 2009-02-26 13:59 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-kernel, Peter Zijlstra, Ingo Molnar
On Thu, 26 Feb 2009, Uwe Kleine-K?nig wrote:
> Hi Steven,
>
> On Thu, Feb 26, 2009 at 12:08:06AM -0500, Steven Rostedt wrote:
> > On Wed, Feb 25, 2009 at 11:16:09PM +0100, Uwe Kleine-K??nig 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>
> >
> > Ah, but unfortunately this will break other archs :-(
> >
> > They may not use FTRACE, but they do include the ftrace header (the
> > ftrace.h header can be used for other types of tracing, not just
> > function tracing).
> Then that's from generic files, because the archs that don't have
> <asm/ftrace.h> don't include <linus/ftrace.h> under arch/.
>
> > A better solution would be to move the CALLER_ADDER0 out of the
> > ftrace.h header completely. Not sure where though. Have a caller.h ?
> > And then we can have ftrace.h include caller.h. A asm/caller.h can be
> > used to override the default.
> Well, but then every arch needs this file. I don't see an advantage
> here. So I'd favour to add an empty ftrace.h for the relevant archs.
The safest bet is then to add an empty ftrace.h to all archs.
Anyone else have any issues with that?
If this happens, you can put the asm/ftrace.h at the top and remove the
asm/ftrace.h referenced in the DYNAMIC_FTRACE ifdef.
-- Steve
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] make CALLER_ADDRx overwriteable
2009-02-26 13:59 ` Steven Rostedt
@ 2009-02-26 22:11 ` Uwe Kleine-König
2009-02-27 7:32 ` KOSAKI Motohiro
0 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2009-02-26 22:11 UTC (permalink / raw)
To: linux-kernel; +Cc: Steven Rostedt, Peter Zijlstra, Ingo Molnar
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.
Because now <asm/ftrace.h> is included unconditionally in
<linux/ftrace.h> all archs that don't already had this include get an
empty one for free.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
--
Hello,
as Steven suggested I added empty <asm/ftrace.h> files since the last
version of this patch.
@Ingo: I assume this update doesn't invalidate your Acked-by:, but to
be on the save side I didn't add it here.
Best regards
Uwe
---
arch/alpha/include/asm/ftrace.h | 1 +
arch/avr32/include/asm/ftrace.h | 1 +
arch/blackfin/include/asm/ftrace.h | 1 +
arch/cris/include/asm/ftrace.h | 1 +
arch/h8300/include/asm/ftrace.h | 1 +
arch/m68k/include/asm/ftrace.h | 1 +
arch/mips/include/asm/ftrace.h | 1 +
arch/parisc/include/asm/ftrace.h | 1 +
arch/um/include/asm/ftrace.h | 1 +
arch/xtensa/include/asm/ftrace.h | 1 +
include/asm-frv/ftrace.h | 1 +
include/asm-m32r/ftrace.h | 1 +
include/asm-mn10300/ftrace.h | 1 +
include/linux/ftrace.h | 41 ++++++++++++++++++-----------------
14 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/arch/alpha/include/asm/ftrace.h b/arch/alpha/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/alpha/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/avr32/include/asm/ftrace.h b/arch/avr32/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/avr32/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/blackfin/include/asm/ftrace.h b/arch/blackfin/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/blackfin/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/cris/include/asm/ftrace.h b/arch/cris/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/cris/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/h8300/include/asm/ftrace.h b/arch/h8300/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/h8300/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/m68k/include/asm/ftrace.h b/arch/m68k/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/m68k/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/mips/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/parisc/include/asm/ftrace.h b/arch/parisc/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/parisc/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/um/include/asm/ftrace.h b/arch/um/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/um/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/xtensa/include/asm/ftrace.h b/arch/xtensa/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/xtensa/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/include/asm-frv/ftrace.h b/include/asm-frv/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/include/asm-frv/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/include/asm-m32r/ftrace.h b/include/asm-m32r/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/include/asm-m32r/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/include/asm-mn10300/ftrace.h b/include/asm-mn10300/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/include/asm-mn10300/ftrace.h
@@ -0,0 +1 @@
+/* empty */
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 */
#ifdef CONFIG_IRQSOFF_TRACER
extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
--
tg: (db50eec..) t/ftrace/make_CALLER_ADDRx_overwriteable (depends on: tip/master)
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
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
0 siblings, 1 reply; 15+ messages in thread
From: KOSAKI Motohiro @ 2009-02-27 7:32 UTC (permalink / raw)
To: Uwe Kleine-Konig
Cc: kosaki.motohiro, linux-kernel, Steven Rostedt, Peter Zijlstra,
Ingo Molnar
> 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.
>
> Because now <asm/ftrace.h> is included unconditionally in
> <linux/ftrace.h> all archs that don't already had this include get an
> empty one for free.
AFAIK, ia64 also doesn't work for N > 0.
thanks, good patch.
> -#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
but I think this "#ifndef CALLER_ADDR0" don't explain developer intention at all.
ARCH_HAS_XXXXX macro is better?
I would like to hear another developer opinions.
> +# 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 */
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
2009-02-27 7:32 ` KOSAKI Motohiro
@ 2009-02-27 11:22 ` Uwe Kleine-König
2009-02-27 15:21 ` Steven Rostedt
0 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2009-02-27 11:22 UTC (permalink / raw)
To: KOSAKI Motohiro; +Cc: linux-kernel, Steven Rostedt, Peter Zijlstra, Ingo Molnar
Hi,
On Fri, Feb 27, 2009 at 04:32:45PM +0900, KOSAKI Motohiro wrote:
> > -#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
>
> but I think this "#ifndef CALLER_ADDR0" don't explain developer intention at all.
> ARCH_HAS_XXXXX macro is better?
OK, this seems clearer. I'd use HAVE_ARCH_CALLER_ADDR though.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
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
0 siblings, 1 reply; 15+ messages in thread
From: Steven Rostedt @ 2009-02-27 15:21 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: KOSAKI Motohiro, linux-kernel, Peter Zijlstra, Ingo Molnar
On Fri, 27 Feb 2009, Uwe Kleine-K?nig wrote:
> Hi,
>
> On Fri, Feb 27, 2009 at 04:32:45PM +0900, KOSAKI Motohiro wrote:
> > > -#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
> >
> > but I think this "#ifndef CALLER_ADDR0" don't explain developer intention at all.
> > ARCH_HAS_XXXXX macro is better?
> OK, this seems clearer. I'd use HAVE_ARCH_CALLER_ADDR though.
Yes, I agree using HAVE_ARH_CALLER_ADDR is the way to handle this.
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] make CALLER_ADDRx overwriteable
2009-02-27 15:21 ` Steven Rostedt
@ 2009-02-27 20:30 ` Uwe Kleine-König
2009-02-28 6:40 ` KOSAKI Motohiro
0 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2009-02-27 20:30 UTC (permalink / raw)
To: linux-kernel; +Cc: Steven Rostedt, Peter Zijlstra, Ingo Molnar
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.
Because now <asm/ftrace.h> is included unconditionally in
<linux/ftrace.h> all archs that don't already had this include get an
empty one for free.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
--
Hello,
OK, changed to check for HAVE_ARCH_CALLER_ADDR instead of CALLER_ADDR0.
Best regards
Uwe
---
arch/alpha/include/asm/ftrace.h | 1 +
arch/avr32/include/asm/ftrace.h | 1 +
arch/blackfin/include/asm/ftrace.h | 1 +
arch/cris/include/asm/ftrace.h | 1 +
arch/h8300/include/asm/ftrace.h | 1 +
arch/m68k/include/asm/ftrace.h | 1 +
arch/mips/include/asm/ftrace.h | 1 +
arch/parisc/include/asm/ftrace.h | 1 +
arch/um/include/asm/ftrace.h | 1 +
arch/xtensa/include/asm/ftrace.h | 1 +
include/asm-frv/ftrace.h | 1 +
include/asm-m32r/ftrace.h | 1 +
include/asm-mn10300/ftrace.h | 1 +
include/linux/ftrace.h | 41 ++++++++++++++++++-----------------
14 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/arch/alpha/include/asm/ftrace.h b/arch/alpha/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/alpha/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/avr32/include/asm/ftrace.h b/arch/avr32/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/avr32/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/blackfin/include/asm/ftrace.h b/arch/blackfin/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/blackfin/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/cris/include/asm/ftrace.h b/arch/cris/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/cris/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/h8300/include/asm/ftrace.h b/arch/h8300/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/h8300/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/m68k/include/asm/ftrace.h b/arch/m68k/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/m68k/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/mips/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/parisc/include/asm/ftrace.h b/arch/parisc/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/parisc/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/um/include/asm/ftrace.h b/arch/um/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/um/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/arch/xtensa/include/asm/ftrace.h b/arch/xtensa/include/asm/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/arch/xtensa/include/asm/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/include/asm-frv/ftrace.h b/include/asm-frv/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/include/asm-frv/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/include/asm-m32r/ftrace.h b/include/asm-m32r/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/include/asm-m32r/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/include/asm-mn10300/ftrace.h b/include/asm-mn10300/ftrace.h
new file mode 100644
index 0000000..40a8c17
--- /dev/null
+++ b/include/asm-mn10300/ftrace.h
@@ -0,0 +1 @@
+/* empty */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 847bb3c..1f69ac7 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 HAVE_ARCH_CALLER_ADDR
+# 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 HAVE_ARCH_CALLER_ADDR */
#ifdef CONFIG_IRQSOFF_TRACER
extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
--
tg: (db50eec..) t/ftrace/make_CALLER_ADDRx_overwriteable (depends on: tip/master)
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
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
0 siblings, 1 reply; 15+ messages in thread
From: KOSAKI Motohiro @ 2009-02-28 6:40 UTC (permalink / raw)
To: Uwe Kleine-Konig
Cc: kosaki.motohiro, linux-kernel, Steven Rostedt, Peter Zijlstra,
Ingo Molnar
> 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.
>
> Because now <asm/ftrace.h> is included unconditionally in
> <linux/ftrace.h> all archs that don't already had this include get an
> empty one for free.
>
> Signed-off-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@elte.hu>
> --
> Hello,
>
> OK, changed to check for HAVE_ARCH_CALLER_ADDR instead of CALLER_ADDR0.
>
> Best regards
> Uwe
thanks.
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] make CALLER_ADDRx overwriteable
2009-02-28 6:40 ` KOSAKI Motohiro
@ 2009-02-28 7:25 ` Uwe Kleine-König
0 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2009-02-28 7:25 UTC (permalink / raw)
To: KOSAKI Motohiro; +Cc: linux-kernel, Steven Rostedt, Peter Zijlstra, Ingo Molnar
Hello,
On Sat, Feb 28, 2009 at 03:40:44PM +0900, KOSAKI Motohiro wrote:
> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
I noted it for the next submission (if any).
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2009-02-28 7:26 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1235594749-24585-1-git-send-email-u.kleine-koenig@pengutronix.de>
2009-02-26 3:02 ` [PATCH] make CALLER_ADDRx overwriteable Ingo Molnar
2009-02-26 3:13 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox