Message ID | 20090203145649.GA19955@oksana.dev.rtsoft.ru (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
* Anton Vorontsov <avorontsov@ru.mvista.com> wrote: > According to this discussion: > > http://lkml.org/lkml/2008/7/25/338 > http://lkml.org/lkml/2008/7/26/72 > > Frame pointers do nothing useful on PowerPC, so lib/Kconfig.debug > makes CONFIG_FRAME_POINTER unselectable on PPC targets. But ftrace.h > requires CONFIG_FRAME_POINTER for CALLER_ADDR macros. [...] hm, why not add PPC to FRAME_POINTERS list of architectures, and select it from the powerpc arch Kconfig? Does that cause complications somewhere? Ingo
On Tue, Feb 03, 2009 at 05:06:45PM +0100, Ingo Molnar wrote: > > * Anton Vorontsov <avorontsov@ru.mvista.com> wrote: > > > According to this discussion: > > > > http://lkml.org/lkml/2008/7/25/338 > > http://lkml.org/lkml/2008/7/26/72 > > > > Frame pointers do nothing useful on PowerPC, so lib/Kconfig.debug > > makes CONFIG_FRAME_POINTER unselectable on PPC targets. But ftrace.h > > requires CONFIG_FRAME_POINTER for CALLER_ADDR macros. [...] > > hm, why not add PPC to FRAME_POINTERS list of architectures, and select it > from the powerpc arch Kconfig? Does that cause complications somewhere? -fno-omit-frame-pointers makes the code worse w/o any actual benefit that we would use. Plus, there is a long standing bug in gcc that makes -fno-omit-frame-pointer generate wrong code for PPC targets: http://lkml.org/lkml/2008/9/2/25 That is, the only tracer that needs[1] -fno-omit-frame-pointer is "FUNCTION_TRCER", but we workaround the issue via -mno-sched-epilog, quoting arch/powerpc/Makefile: # Work around a gcc code-gen bug with -fno-omit-frame-pointer. ifeq ($(CONFIG_FUNCTION_TRACER),y) KBUILD_CFLAGS += -mno-sched-epilog endif [1] Btw, why exactly do we need the -fno-omit-frame-pointer for "FUNCTION_TRCER" tracer? Why just -pg isn't sufficient?..
On Tue, 2009-02-03 at 19:19 +0300, Anton Vorontsov wrote: > On Tue, Feb 03, 2009 at 05:06:45PM +0100, Ingo Molnar wrote: > [1] Btw, why exactly do we need the -fno-omit-frame-pointer for > "FUNCTION_TRCER" tracer? Why just -pg isn't sufficient?.. > The problem is this that is in the toplevel Makefile: ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls else KBUILD_CFLAGS += -fomit-frame-pointer endif -pg is incompatible with -fomit-frame-pointer -- Steve
On Tue, Feb 03, 2009 at 11:32:18AM -0500, Steven Rostedt wrote: > > On Tue, 2009-02-03 at 19:19 +0300, Anton Vorontsov wrote: > > On Tue, Feb 03, 2009 at 05:06:45PM +0100, Ingo Molnar wrote: > > > [1] Btw, why exactly do we need the -fno-omit-frame-pointer for > > "FUNCTION_TRCER" tracer? Why just -pg isn't sufficient?.. > > > > The problem is this that is in the toplevel Makefile: > > > ifdef CONFIG_FRAME_POINTER > KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls > else > KBUILD_CFLAGS += -fomit-frame-pointer > endif > > > -pg is incompatible with -fomit-frame-pointer Ah... $ gcc -pg -fomit-frame-pointer -S c.c gcc: -pg and -fomit-frame-pointer are incompatible It's hard-coded in gcc, in the code that don't know about architecture details. But on PowerPC -O1 implies -fomit-frame-pointer, that is gcc -pg -O1 -fno-omit-frame-pointer and gcc -pg -O1 produce different outputs. Thus -pg -O should be the same as "-pg -O -fomit-framepointer".
On Tue, 2009-02-03 at 21:59 +0300, Anton Vorontsov wrote: > On Tue, Feb 03, 2009 at 11:32:18AM -0500, Steven Rostedt wrote: > > > > On Tue, 2009-02-03 at 19:19 +0300, Anton Vorontsov wrote: > > > On Tue, Feb 03, 2009 at 05:06:45PM +0100, Ingo Molnar wrote: > > > > > [1] Btw, why exactly do we need the -fno-omit-frame-pointer for > > > "FUNCTION_TRCER" tracer? Why just -pg isn't sufficient?.. > > > > > > > The problem is this that is in the toplevel Makefile: > > > > > > ifdef CONFIG_FRAME_POINTER > > KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls > > else > > KBUILD_CFLAGS += -fomit-frame-pointer > > endif > > And don't forget the gcc bug that miscompiles function epilogues on ppc with -fno-omit-frame-pointer (iirc), which we need to work around using -mno-sched-epilog. Currently, we set that only if CONFIG_FUNCTION_TRACER is set, ie, we assume that we only set -fno-omit-frame-pointer when CONFIG_FUNCTION_TRACER is set. Ben.
unsubscribe linux-kernel
unsubscribe linux-kernel
On Tue, Feb 03, 2009 at 07:19:55PM +0300, Anton Vorontsov wrote: > On Tue, Feb 03, 2009 at 05:06:45PM +0100, Ingo Molnar wrote: > > > > * Anton Vorontsov <avorontsov@ru.mvista.com> wrote: > > > > > According to this discussion: > > > > > > http://lkml.org/lkml/2008/7/25/338 > > > http://lkml.org/lkml/2008/7/26/72 > > > > > > Frame pointers do nothing useful on PowerPC, so lib/Kconfig.debug > > > makes CONFIG_FRAME_POINTER unselectable on PPC targets. But ftrace.h > > > requires CONFIG_FRAME_POINTER for CALLER_ADDR macros. [...] > > > > hm, why not add PPC to FRAME_POINTERS list of architectures, and select it > > from the powerpc arch Kconfig? Does that cause complications somewhere? > > -fno-omit-frame-pointers makes the code worse w/o any actual > benefit that we would use. Plus, there is a long standing bug in > gcc that makes -fno-omit-frame-pointer generate wrong code for PPC > targets: > > http://lkml.org/lkml/2008/9/2/25 > > That is, the only tracer that needs[1] -fno-omit-frame-pointer is > "FUNCTION_TRCER", but we workaround the issue via -mno-sched-epilog, > quoting arch/powerpc/Makefile: > > # Work around a gcc code-gen bug with -fno-omit-frame-pointer. > ifeq ($(CONFIG_FUNCTION_TRACER),y) > KBUILD_CFLAGS += -mno-sched-epilog > endif Thinking about it more... we can workaround the bug the other way, and then permit CONFIG_FRAME_POINTER on PowerPC. Patches are coming...
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 74cc312..d1c67bd 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -111,6 +111,7 @@ config PPC select HAVE_FTRACE_MCOUNT_RECORD select HAVE_DYNAMIC_FTRACE select HAVE_FUNCTION_TRACER + select ARCH_HAS_NORMAL_FRAME_POINTERS select ARCH_WANT_OPTIONAL_GPIOLIB select HAVE_IDE select HAVE_IOREMAP_PROT diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 7840e71..ede3fe2 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -237,7 +237,8 @@ static inline void __ftrace_enabled_restore(int enabled) #endif } -#ifdef CONFIG_FRAME_POINTER +#if defined(CONFIG_FRAME_POINTER) || \ + defined(CONFIG_ARCH_HAS_NORMAL_FRAME_POINTERS) /* 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)) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 29044f5..808f4e2 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -579,6 +579,12 @@ config ARCH_WANT_FRAME_POINTERS bool help +config ARCH_HAS_NORMAL_FRAME_POINTERS + bool + help + Architectures should select this symbol if their ABI implies + having a frame pointer. + config FRAME_POINTER bool "Compile the kernel with frame pointers" depends on DEBUG_KERNEL && \