ftrace: On PowerPC we don't need frame pointers for CALLER_ADDRs
Subsystems (6)
PATCH 1/1 ftrace: On PowerPC we don't need frame pointers for CALLER_ADDRs
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. Therefore tracing is completely useless on PowerPC:
[...]
<idle>-0 0X.h3 2us+: 0:140:R + [000] 1733:120:S mvtsd <idle>-0 0X.h3 9us+: 0 (0) <idle>-0 0X..3 72us : 0 (0) <idle>-0 0X..3 73us : 0:140:R ==> [000] 1733:120:R mvtsd
On PPC we can safely use __builtin_return_address(1..6) w/o frame pointers, and with this patch the trace output looks OK:
[...]
<idle>-0 0X.h3 2us+: 0:140:R + [000] 1740:120:S mvtsd <idle>-0 0X.h3 9us+: hrtimer_wakeup (__run_hrtimer) <idle>-0 0X..3 87us : cpu_idle (__got2_end) <idle>-0 0X..3 89us : 0:140:R ==> [000] 1740:120:R mvtsd
---
Btw, on PowerPC tracing is also broken w/o "ring-buffer: fix alignment problem" patch (currently collecting dust in the -tip tree, commit 082605de5f82eb692cc90f7fda071cc01bb5ac34). Any chance the fix go into Linus' tree, to not waste other people's time bisecting and debugging the problem? ;-)
For google: tracing, regression, "ring-buffer: move some metadata into buffer page", commit abc9b56d66fbd4d93302ef4bf6fa726e1b8255f9, answer is here.
include/linux/ftrace.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/ftrace.h +1 -1
@@ -146,7 +146,7 @@ static inline void __ftrace_enabled_restore(int enabled)#endif } -#ifdef CONFIG_FRAME_POINTER +#if defined(CONFIG_FRAME_POINTER ) || defined(CONFIG_PPC )/* 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))
Signature · 1 line
1.5.6.5
Quoted 9 lines · Anton Vorontsov
According to this discussion:
http://lkml.org/lkml/2008/7/25/338
http://lkml.org/lkml/2008/7/26/72Frame pointers do nothing useful on PowerPC, so
lib/Kconfig.debugmakesCONFIG_FRAME_POINTERunselectable on PPC targets. Butftrace.hrequiresCONFIG_FRAME_POINTERforCALLER_ADDRmacros. Therefore tracing is completely useless on PowerPC:
But we need them for -pg which ftrace uses no ? (ie, gcc forces you to have -fno-omit-frame-pointers with -fpg iirc).
Now, regardless, I agree that on PPC, __builtin_return_address() should always work with our without that cruft, so we may as well apply that patch...
Quoted 44 lines
[...]
<idle>-0 0X.h3 2us+: 0:140:R + [000] 1733:120:S mvtsd <idle>-0 0X.h3 9us+: 0 (0) <idle>-0 0X..3 72us : 0 (0) <idle>-0 0X..3 73us : 0:140:R ==> [000] 1733:120:R mvtsdOn PPC we can safely use
__builtin_return_address(1..6)w/o frame pointers, and with this patch the trace output looks OK:[...]
<idle>-0 0X.h3 2us+: 0:140:R + [000] 1740:120:S mvtsd <idle>-0 0X.h3 9us+: hrtimer_wakeup (__run_hrtimer) <idle>-0 0X..3 87us : cpu_idle (__got2_end) <idle>-0 0X..3 89us : 0:140:R ==> [000] 1740:120:R mvtsdSigned-off-by Anton Vorontsov <[email protected]>---
Btw, on PowerPC tracing is also broken w/o "ring-buffer: fix alignment problem" patch (currently collecting dust in the -tip tree, commit
082605de5f82eb692cc90f7fda071cc01bb5ac34). Any chance the fix go into Linus' tree, to not waste other people's time bisecting and debugging the problem? ;-)For google: tracing, regression, "ring-buffer: move some metadata into buffer page", commit
abc9b56d66fbd4d93302ef4bf6fa726e1b8255f9, answer is here.include/linux/ftrace.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/ftrace.h +1
-1@@ -146,7 +146,7 @@ static inline void __ftrace_enabled_restore(int enabled)#endif } -#ifdef CONFIG_FRAME_POINTER +#if defined(CONFIG_FRAME_POINTER ) || defined(CONFIG_PPC )/* 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))
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 5 lines · Anton Vorontsov
According to this discussion:
http://lkml.org/lkml/2008/7/25/338
http://lkml.org/lkml/2008/7/26/72
Quoted 7 lines
Quoted 4 lines
Frame pointers do nothing useful on PowerPC, so
lib/Kconfig.debugmakesCONFIG_FRAME_POINTERunselectable on PPC targets. Butftrace.hrequiresCONFIG_FRAME_POINTERforCALLER_ADDRmacros. Therefore tracing is completely useless on PowerPC:But we need them for -pg which ftrace uses no ? (ie, gcc forces you to have -fno-omit-frame-pointers with -fpg iirc).
Yes, ftrace function tracing requires -pg which requires FRAME_POINTER turned on.
Quoted 44 lines
Now, regardless, I agree that on PPC,
__builtin_return_address()should always work with our without that cruft, so we may as well apply that patch...Quoted 39 lines
[...]
<idle>-0 0X.h3 2us+: 0:140:R + [000] 1733:120:S mvtsd <idle>-0 0X.h3 9us+: 0 (0) <idle>-0 0X..3 72us : 0 (0) <idle>-0 0X..3 73us : 0:140:R ==> [000] 1733:120:R mvtsdOn PPC we can safely use
__builtin_return_address(1..6)w/o frame pointers, and with this patch the trace output looks OK:[...]
<idle>-0 0X.h3 2us+: 0:140:R + [000] 1740:120:S mvtsd <idle>-0 0X.h3 9us+: hrtimer_wakeup (__run_hrtimer) <idle>-0 0X..3 87us : cpu_idle (__got2_end) <idle>-0 0X..3 89us : 0:140:R ==> [000] 1740:120:R mvtsdSigned-off-by Anton Vorontsov <[email protected]>---
Btw, on PowerPC tracing is also broken w/o "ring-buffer: fix alignment problem" patch (currently collecting dust in the -tip tree, commit
082605de5f82eb692cc90f7fda071cc01bb5ac34). Any chance the fix go into Linus' tree, to not waste other people's time bisecting and debugging the problem? ;-)For google: tracing, regression, "ring-buffer: move some metadata into buffer page", commit
abc9b56d66fbd4d93302ef4bf6fa726e1b8255f9, answer is here.include/linux/ftrace.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/ftrace.h +0
-0@@ -146,7 +146,7 @@ static inline void __ftrace_enabled_restore(int enabled)#endif }
Quoted 2 lines
include/linux/ftrace.h static inline void __ftrace_enabled_restore(int enabled) · line 149
Quoted 2 lines
include/linux/ftrace.h +1
-1-#ifdef CONFIG_FRAME_POINTER +#if defined(CONFIG_FRAME_POINTER ) || defined(CONFIG_PPC )
Perhaps we should add a HAVE_NORMAL_FRAME_POINTERS in arch/powerpc/Kconfig under PPC and then we can change the above line to:
#if defined(CONFIG_FRAME_POINTERS) || \
defined(CONFIG_HAVE_NORMAL_FRAME_POINTERS)
This way when another arch wants to belong to this, we do not need to have a list of archs here.
-- Steve
Quoted 4 lines
Quoted 3 lines
include/linux/ftrace.h +0
-0/* 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))
PATCH v2 1/1 ftrace: On PowerPC we don't need frame pointers for CALLER_ADDRs
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. Therefore tracing is completely useless on PowerPC:
[...]
<idle>-0 0X.h3 2us+: 0:140:R + [000] 1733:120:S mvtsd <idle>-0 0X.h3 9us+: 0 (0) <idle>-0 0X..3 72us : 0 (0) <idle>-0 0X..3 73us : 0:140:R ==> [000] 1733:120:R mvtsd
This patch introduces a ARCH_HAS_NORMAL_FRAME_POINTERS Kconfig symbol, when selected the CALLER_ADDR macros are available without the FRAME_POINTER Kconfig symbol.
With this patch the trace output turns into:
[...]
<idle>-0 0X.h3 2us+: 0:140:R + [000] 1740:120:S mvtsd <idle>-0 0X.h3 9us+: hrtimer_wakeup (__run_hrtimer) <idle>-0 0X..3 87us : cpu_idle (__got2_end) <idle>-0 0X..3 89us : 0:140:R ==> [000] 1740:120:R mvtsd
---
On Mon, Feb 02, 2009 at 09:04:15AM -0500, Steven Rostedt wrote:
[...]
Quoted 11 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +1
-1-#ifdef CONFIG_FRAME_POINTER +#if defined(CONFIG_FRAME_POINTER) || defined(CONFIG_PPC)Perhaps we should add a
HAVE_NORMAL_FRAME_POINTERSinarch/powerpc/Kconfigunder PPC and then we can change the above line to:#if
defined(CONFIG_FRAME_POINTERS)|| \
defined(CONFIG_HAVE_NORMAL_FRAME_POINTERS)This way when another arch wants to belong to this, we do not need to have a list of archs here.
Would it be better if we introduce ARCH_HAS_NORMAL_FRAME_POINTERS in lib/Kconfig.debug, along with ARCH_WANT_FRAME_POINTERS?
Note that we can't use ARCH_WANT_FRAME_POINTERS for our needs since that symbol is used for other (mostly cosmetic) purposes: whether we we want CONFIG_FRAME_POINTER depend on CONFIG_DEBUG_KERNEL, and whether frame pointers should be default =y (see commit da4276b8299a6544dc41ac2485d3ffca5811b3fb).
arch/powerpc/Kconfig | 1 + include/linux/ftrace.h | 3 ++- lib/Kconfig.debug | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletions(-)
arch/powerpc/Kconfig +1 -0
@@ -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
include/linux/ftrace.h +2 -1
@@ -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))
lib/Kconfig.debug +6 -0
@@ -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 && \
Signature · 1 line
1.5.6.5
Quoted 8 lines · Anton Vorontsov
According to this discussion:
http://lkml.org/lkml/2008/7/25/338
http://lkml.org/lkml/2008/7/26/72Frame pointers do nothing useful on PowerPC, so
lib/Kconfig.debugmakesCONFIG_FRAME_POINTERunselectable on PPC targets. Butftrace.hrequiresCONFIG_FRAME_POINTERforCALLER_ADDRmacros. [...]
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
Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Anton Vorontsov
According to this discussion:
http://lkml.org/lkml/2008/7/25/338
http://lkml.org/lkml/2008/7/26/72
Quoted 6 lines
Quoted 3 lines
Frame pointers do nothing useful on PowerPC, so
lib/Kconfig.debugmakesCONFIG_FRAME_POINTERunselectable on PPC targets. Butftrace.hrequiresCONFIG_FRAME_POINTERforCALLER_ADDRmacros. [...]hm, why not add PPC to
FRAME_POINTERSlist of architectures, and select it from the powerpc archKconfig? 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?..
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Quoted 5 lines · Anton Vorontsov
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_POINTERKBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
elseKBUILD_CFLAGS += -fomit-frame-pointer
endif
-pg is incompatible with -fomit-frame-pointer
-- Steve
Quoted 11 lines · Steven Rostedt
Quoted 5 lines · Anton Vorontsov
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:
Quoted 8 lines
ifdef
CONFIG_FRAME_POINTERKBUILD_CFLAGS+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
elseKBUILD_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".
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Quoted 12 lines · Anton Vorontsov
Quoted 11 lines · Steven Rostedt
Quoted 5 lines · Anton Vorontsov
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:
Quoted 6 lines
Quoted 6 lines
ifdef
CONFIG_FRAME_POINTERKBUILD_CFLAGS+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
elseKBUILD_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.
RE: [PATCH v2] ftrace: On PowerPC we don't need frame pointers forCALLER_ADDRs
In reply to Anton Vorontsovunsubscribe linux-kernel
unsubscribe linux-kernel
Quoted 23 lines · Anton Vorontsov
Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Anton Vorontsov
According to this discussion:
http://lkml.org/lkml/2008/7/25/338
http://lkml.org/lkml/2008/7/26/72Quoted 6 lines
Quoted 3 lines
Frame pointers do nothing useful on PowerPC, so
lib/Kconfig.debugmakesCONFIG_FRAME_POINTERunselectable on PPC targets. Butftrace.hrequiresCONFIG_FRAME_POINTERforCALLER_ADDRmacros. [...]hm, why not add PPC to
FRAME_POINTERSlist of architectures, and select it from the powerpc archKconfig? 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:
Quoted 8 lines
That is, the only tracer that needs[1] -fno-omit-frame-pointer is "
FUNCTION_TRCER", but we workaround the issue via -mno-sched-epilog, quotingarch/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...
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
PATCH 1/3 Makefile: Include arch Makefiles as late as possible
This patch gives arches more freedom on overwriting CFLAGS, specifically on PowerPC we want to remove -fno-omit-frame-pointer flag.
--- Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Makefile +0 -1
@@ -525,8 +525,6 @@ else KBUILD_CFLAGS += -O2 endif -include $(srctree)/arch/$(SRCARCH)/Makefile
PATCH 2/3 powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Anton VorontsovRemove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.
--- arch/powerpc/Makefile | 10 ++++++---- arch/powerpc/kernel/Makefile | 10 +++++----- arch/powerpc/platforms/powermac/Makefile | 2 +- lib/Kconfig.debug | 8 ++++---- 4 files changed, 16 insertions(+), 14 deletions(-)
arch/powerpc/Makefile +6 -4
@@ -120,10 +120,12 @@ ifeq ($(CONFIG_6xx),y) KBUILD_CFLAGS += -mcpu=powerpc endif -# Work around a gcc code-gen bug with -fno-omit-frame-pointer. -ifeq ($(CONFIG_FUNCTION_TRACER),y) -KBUILD_CFLAGS += -mno-sched-epilog -endif +# Remove -fno-omit-frame-pointer flag. There are two reasons: +# 1. On powerpc we always have frame pointers. +# 2. Some gcc versions might generate wrong code with -fno-omit-frame-pointer +# flag. So, if for some reason you're going to remove this line, then add +# -mno-sched-epilog to workaround the gcc bug. +KBUILD_CFLAGS := $(subst -fno-omit-frame-pointer,,$(KBUILD_CFLAGS)) cpu-as-$(CONFIG_4xx) += -Wa,-m405 cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
arch/powerpc/kernel/Makefile +5 -5
@@ -14,14 +14,14 @@ endif ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_btext.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_cputable.o = -pg +CFLAGS_REMOVE_prom_init.o = -pg +CFLAGS_REMOVE_btext.o = -pg +CFLAGS_REMOVE_prom.o = -pg ifdef CONFIG_DYNAMIC_FTRACE # dynamic ftrace setup. -CFLAGS_REMOVE_ftrace.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_ftrace.o = -pg endif endif
arch/powerpc/platforms/powermac/Makefile +1 -1
@@ -2,7 +2,7 @@ CFLAGS_bootx_init.o += -fPIC ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_bootx_init.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_bootx_init.o = -pg endif obj-y += pic.o setup.o time.o feature.o pci.o \
lib/Kconfig.debug +4 -4
@@ -402,7 +402,7 @@ config LOCKDEP bool depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT select STACKTRACE - select FRAME_POINTER if !X86 && !MIPS && !PPC + select FRAME_POINTER if !X86 && !MIPS select KALLSYMS select KALLSYMS_ALL
@@ -583,7 +583,7 @@ config FRAME_POINTER bool "Compile the kernel with frame pointers" depends on DEBUG_KERNEL && \ (CRIS || M68K || M68KNOMMU || FRV || UML || S390 || \ - AVR32 || SUPERH || BLACKFIN || MN10300) || \ + AVR32 || SUPERH || BLACKFIN || MN10300 || PPC) || \ ARCH_WANT_FRAME_POINTERS default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS help
@@ -771,13 +771,13 @@ config FAULT_INJECTION_STACKTRACE_FILTER depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on !X86_64 select STACKTRACE - select FRAME_POINTER if !PPC + select FRAME_POINTER help Provide stacktrace filter for fault-injection capabilities config LATENCYTOP bool "Latency measuring infrastructure" - select FRAME_POINTER if !MIPS && !PPC + select FRAME_POINTER if !MIPS select KALLSYMS select KALLSYMS_ALL select STACKTRACE
Signature · 1 line
1.5.6.5
PATCH 3/3 tracing: Tracers that use CALLER_ADDR macros should select FRAME_POINTER
In reply to Anton VorontsovIrqsoff, switch and preempt tracers use CALLER_ADDR macros, so they should select FRAME_POINTER. Otherwise traces are meaningless.
--- kernel/trace/Kconfig | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/trace/Kconfig +3 -0
@@ -86,6 +86,7 @@ config IRQSOFF_TRACER select TRACE_IRQFLAGS select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in irqs-off critical sections, with microsecond accuracy.
@@ -108,6 +109,7 @@ config PREEMPT_TRACER depends on DEBUG_KERNEL select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in preemption off critical sections, with microsecond accuracy.
@@ -136,6 +138,7 @@ config SCHED_TRACER select TRACING select CONTEXT_SWITCH_TRACER select TRACER_MAX_TRACE + select FRAME_POINTER help This tracer tracks the latency of the highest priority task to be scheduled in, starting from the point it has woken up.
Signature · 1 line
1.5.6.5
Re: [PATCH 3/3] tracing: Tracers that use CALLER_ADDR macros should select FRAME_POINTER
2009/2/4 Anton Vorontsov <[email protected]>:
Quoted 29 lines
Irqsoff, switch and preempt tracers use
CALLER_ADDRmacros, so they should selectFRAME_POINTER. Otherwise traces are meaningless.Signed-off-by Anton Vorontsov <[email protected]>--- kernel/trace/Kconfig | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)kernel/trace/Kconfig +2
-0@@ -86,6 +86,7 @@ config IRQSOFF_TRACER select TRACE_IRQFLAGS select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in irqs-off critical sections, with microsecond accuracy.@@ -108,6 +109,7 @@ config PREEMPT_TRACER depends on DEBUG_KERNEL select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in preemption off critical sections, with microsecond accuracy.
kernel/trace/Kconfig config SCHED_TRACER
Quoted 8 lines
kernel/trace/Kconfig +1
-1@@ -136,6 +138,7 @@ config SCHED_TRACER select TRACING select CONTEXT_SWITCH_TRACER select TRACER_MAX_TRACE + select FRAME_POINTER help This tracer tracks the latency of the highest priority task to be scheduled in, starting from the point it has woken up. --
Looks right.
BTW, how behaves builtin_return_address in case of !FRAME_POINTERS ? I guess it would only work with the first caller builtin_return_address(0)
Re: [PATCH 3/3] tracing: Tracers that use CALLER_ADDR macros should select FRAME_POINTER
Quoted 42 lines · Frédéric Weisbecker
2009/2/4 Anton Vorontsov <[email protected]>:
Quoted 29 lines
Irqsoff, switch and preempt tracers use
CALLER_ADDRmacros, so they should selectFRAME_POINTER. Otherwise traces are meaningless.Signed-off-by Anton Vorontsov <[email protected]>--- kernel/trace/Kconfig | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)kernel/trace/Kconfig +2
-0@@ -86,6 +86,7 @@ config IRQSOFF_TRACER select TRACE_IRQFLAGS select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in irqs-off critical sections, with microsecond accuracy.@@ -108,6 +109,7 @@ config PREEMPT_TRACER depends on DEBUG_KERNEL select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in preemption off critical sections, with microsecond accuracy.kernel/trace/Kconfig config SCHED_TRACER
Quoted 8 lines
kernel/trace/Kconfig +1
-1@@ -136,6 +138,7 @@ config SCHED_TRACER select TRACING select CONTEXT_SWITCH_TRACER select TRACER_MAX_TRACE + select FRAME_POINTER help This tracer tracks the latency of the highest priority task to be scheduled in, starting from the point it has woken up. --Looks right.
Quoted 5 lines
BTW, how behaves
builtin_return_addressin case of !FRAME_POINTERS ? I guess it would only work with the first callerbuiltin_return_address(0)Quoted 1 line
From
ftrace.h:
#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
Yep!
-- Steve
Re: [PATCH 3/3] tracing: Tracers that use CALLER_ADDR macros should select FRAME_POINTER
In reply to Frédéric WeisbeckerQuoted 42 lines · Frédéric Weisbecker
2009/2/4 Anton Vorontsov <[email protected]>:
Quoted 29 lines
Irqsoff, switch and preempt tracers use
CALLER_ADDRmacros, so they should selectFRAME_POINTER. Otherwise traces are meaningless.Signed-off-by Anton Vorontsov <[email protected]>--- kernel/trace/Kconfig | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)kernel/trace/Kconfig +2
-0@@ -86,6 +86,7 @@ config IRQSOFF_TRACER select TRACE_IRQFLAGS select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in irqs-off critical sections, with microsecond accuracy.@@ -108,6 +109,7 @@ config PREEMPT_TRACER depends on DEBUG_KERNEL select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in preemption off critical sections, with microsecond accuracy.kernel/trace/Kconfig config SCHED_TRACER
Quoted 8 lines
kernel/trace/Kconfig +1
-1@@ -136,6 +138,7 @@ config SCHED_TRACER select TRACING select CONTEXT_SWITCH_TRACER select TRACER_MAX_TRACE + select FRAME_POINTER help This tracer tracks the latency of the highest priority task to be scheduled in, starting from the point it has woken up. --Looks right.
Quoted 5 lines
BTW, how behaves
builtin_return_addressin case of !FRAME_POINTERS ? I guess it would only work with the first callerbuiltin_return_address(0)From
ftrace.h:
#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
Yep!
-- Steve
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 3/3] tracing: Tracers that use CALLER_ADDR macros should select FRAME_POINTER
In reply to Frédéric WeisbeckerQuoted 42 lines · Frédéric Weisbecker
2009/2/4 Anton Vorontsov <[email protected]>:
Quoted 29 lines
Irqsoff, switch and preempt tracers use
CALLER_ADDRmacros, so they should selectFRAME_POINTER. Otherwise traces are meaningless.Signed-off-by Anton Vorontsov <[email protected]>--- kernel/trace/Kconfig | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)kernel/trace/Kconfig +2
-0@@ -86,6 +86,7 @@ config IRQSOFF_TRACER select TRACE_IRQFLAGS select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in irqs-off critical sections, with microsecond accuracy.@@ -108,6 +109,7 @@ config PREEMPT_TRACER depends on DEBUG_KERNEL select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in preemption off critical sections, with microsecond accuracy.kernel/trace/Kconfig config SCHED_TRACER
Quoted 8 lines
kernel/trace/Kconfig +1
-1@@ -136,6 +138,7 @@ config SCHED_TRACER select TRACING select CONTEXT_SWITCH_TRACER select TRACER_MAX_TRACE + select FRAME_POINTER help This tracer tracks the latency of the highest priority task to be scheduled in, starting from the point it has woken up. --Looks right.
Quoted 5 lines
BTW, how behaves
builtin_return_addressin case of !FRAME_POINTERS ? I guess it would only work with the first callerbuiltin_return_address(0)From
ftrace.h:
#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
Yep!
-- Steve
Re: [PATCH 3/3] tracing: Tracers that use CALLER_ADDR macros should select FRAME_POINTER
In reply to Frédéric WeisbeckerQuoted 42 lines · Frédéric Weisbecker
2009/2/4 Anton Vorontsov <[email protected]>:
Quoted 29 lines
Irqsoff, switch and preempt tracers use
CALLER_ADDRmacros, so they should selectFRAME_POINTER. Otherwise traces are meaningless.Signed-off-by Anton Vorontsov <[email protected]>--- kernel/trace/Kconfig | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)kernel/trace/Kconfig +2
-0@@ -86,6 +86,7 @@ config IRQSOFF_TRACER select TRACE_IRQFLAGS select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in irqs-off critical sections, with microsecond accuracy.@@ -108,6 +109,7 @@ config PREEMPT_TRACER depends on DEBUG_KERNEL select TRACING select TRACER_MAX_TRACE + select FRAME_POINTER help This option measures the time spent in preemption off critical sections, with microsecond accuracy.kernel/trace/Kconfig config SCHED_TRACER
Quoted 8 lines
kernel/trace/Kconfig +1
-1@@ -136,6 +138,7 @@ config SCHED_TRACER select TRACING select CONTEXT_SWITCH_TRACER select TRACER_MAX_TRACE + select FRAME_POINTER help This tracer tracks the latency of the highest priority task to be scheduled in, starting from the point it has woken up. --Looks right.
Quoted 5 lines
BTW, how behaves
builtin_return_addressin case of !FRAME_POINTERS ? I guess it would only work with the first callerbuiltin_return_address(0)From
ftrace.h:
#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
Yep!
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] tracing: Tracers that use CALLER_ADDR macros should select FRAME_POINTER
In reply to Frédéric WeisbeckerOn Wed, Feb 04, 2009 at 04:26:15PM +0100, Frédéric Weisbecker wrote:
[...]
Quoted 13 lines
kernel/trace/Kconfig config SCHED_TRACER
Quoted 9 lines
kernel/trace/Kconfig +1
-1@@ -136,6 +138,7 @@ config SCHED_TRACER select TRACING select CONTEXT_SWITCH_TRACER select TRACER_MAX_TRACE + select FRAME_POINTER help This tracer tracks the latency of the highest priority task to be scheduled in, starting from the point it has woken up. --Looks right.
Quoted 2 lines
BTW, how behaves
builtin_return_addressin case of !FRAME_POINTERS ? I guess it would only work with the first callerbuiltin_return_address(0)
It depends on the architecture. On PowerPC we always have frame pointers, thus __builtin_return_address(1..) will always work. On x86 it won't work that way.
Thanks,
Signature · 7 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] tracing: Tracers that use CALLER_ADDR macros should select FRAME_POINTER
2009/2/4 Steven Rostedt <[email protected]>:
Quoted 22 lines
Quoted 2 lines
From
ftrace.h:#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
Quoted 2 lines
Yep!
Ok.
2009/2/4 Anton Vorontsov <[email protected]>:
Quoted 8 lines
It depends on the architecture. On PowerPC we always have frame pointers, thus
__builtin_return_address(1..)will always work. On x86 it won't work that way.Thanks,
--
Anton Vorontsov
Thanks for your answers!
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Anton VorontsovQuoted 23 lines · Anton Vorontsov
This patch gives arches more freedom on overwriting CFLAGS, specifically on PowerPC we want to remove -fno-omit-frame-pointer flag.
Signed-off-by Anton Vorontsov <[email protected]>--- Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)Makefile +0
-2@@ -525,8 +525,6 @@ else KBUILD_CFLAGS += -O2 endif -include $(srctree)/arch/$(SRCARCH)/Makefile - ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif
Makefile ifdef CONFIG_DEBUG_SECTION_MISMATCH · line 560
Quoted 8 lines
Makefile +2
-0@@ -555,6 +553,8 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif +include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Ingo
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Anton VorontsovQuoted 23 lines · Anton Vorontsov
This patch gives arches more freedom on overwriting CFLAGS, specifically on PowerPC we want to remove -fno-omit-frame-pointer flag.
Signed-off-by Anton Vorontsov <[email protected]>--- Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)Makefile +0
-2@@ -525,8 +525,6 @@ else KBUILD_CFLAGS += -O2 endif -include $(srctree)/arch/$(SRCARCH)/Makefile - ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif
Makefile ifdef CONFIG_DEBUG_SECTION_MISMATCH · line 560
Quoted 8 lines
Makefile +2
-0@@ -555,6 +553,8 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif +include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Ingo
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Anton VorontsovQuoted 23 lines · Anton Vorontsov
This patch gives arches more freedom on overwriting CFLAGS, specifically on PowerPC we want to remove -fno-omit-frame-pointer flag.
Signed-off-by Anton Vorontsov <[email protected]>--- Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)Makefile +0
-2@@ -525,8 +525,6 @@ else KBUILD_CFLAGS += -O2 endif -include $(srctree)/arch/$(SRCARCH)/Makefile - ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif
Makefile ifdef CONFIG_DEBUG_SECTION_MISMATCH · line 560
Quoted 8 lines
Makefile +2
-0@@ -555,6 +553,8 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif +include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Ingo
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Anton VorontsovQuoted 23 lines · Anton Vorontsov
This patch gives arches more freedom on overwriting CFLAGS, specifically on PowerPC we want to remove -fno-omit-frame-pointer flag.
Signed-off-by Anton Vorontsov <[email protected]>--- Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)Makefile +0
-2@@ -525,8 +525,6 @@ else KBUILD_CFLAGS += -O2 endif -include $(srctree)/arch/$(SRCARCH)/Makefile - ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif
Makefile ifdef CONFIG_DEBUG_SECTION_MISMATCH · line 560
Quoted 8 lines
Makefile +2
-0@@ -555,6 +553,8 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif +include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Ingo
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Anton VorontsovQuoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.
But what about -pg -requires -fno-omit-frame-pointer ?
Ben.
Quoted 104 lines
Signed-off-by Anton Vorontsov <[email protected]>--- arch/powerpc/Makefile | 10 ++++++---- arch/powerpc/kernel/Makefile | 10 +++++----- arch/powerpc/platforms/powermac/Makefile | 2 +- lib/Kconfig.debug | 8 ++++---- 4 files changed, 16 insertions(+), 14 deletions(-)arch/powerpc/Makefile +6
-4@@ -120,10 +120,12 @@ ifeq ($(CONFIG_6xx),y) KBUILD_CFLAGS += -mcpu=powerpc endif -# Work around a gcc code-gen bug with -fno-omit-frame-pointer. -ifeq ($(CONFIG_FUNCTION_TRACER),y) -KBUILD_CFLAGS += -mno-sched-epilog -endif +# Remove -fno-omit-frame-pointer flag. There are two reasons: +# 1. On powerpc we always have frame pointers. +# 2. Some gcc versions might generate wrong code with -fno-omit-frame-pointer +# flag. So, if for some reason you're going to remove this line, then add +# -mno-sched-epilog to workaround the gcc bug. +KBUILD_CFLAGS := $(subst -fno-omit-frame-pointer,,$(KBUILD_CFLAGS)) cpu-as-$(CONFIG_4xx) += -Wa,-m405 cpu-as-$(CONFIG_6xx) += -Wa,-maltivecarch/powerpc/kernel/Makefile +5
-5@@ -14,14 +14,14 @@ endif ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_btext.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_cputable.o = -pg +CFLAGS_REMOVE_prom_init.o = -pg +CFLAGS_REMOVE_btext.o = -pg +CFLAGS_REMOVE_prom.o = -pg ifdef CONFIG_DYNAMIC_FTRACE # dynamic ftrace setup. -CFLAGS_REMOVE_ftrace.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_ftrace.o = -pg endif endifarch/powerpc/platforms/powermac/Makefile +1
-1@@ -2,7 +2,7 @@ CFLAGS_bootx_init.o += -fPIC ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_bootx_init.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_bootx_init.o = -pg endif obj-y += pic.o setup.o time.o feature.o pci.o \lib/Kconfig.debug +4
-4@@ -402,7 +402,7 @@ config LOCKDEP bool depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT select STACKTRACE - select FRAME_POINTER if !X86 && !MIPS && !PPC + select FRAME_POINTER if !X86 && !MIPS select KALLSYMS select KALLSYMS_ALL@@ -583,7 +583,7 @@ config FRAME_POINTER bool "Compile the kernel with frame pointers" depends on DEBUG_KERNEL && \ (CRIS || M68K || M68KNOMMU || FRV || UML || S390 || \ - AVR32 || SUPERH || BLACKFIN || MN10300) || \ + AVR32 || SUPERH || BLACKFIN || MN10300 || PPC) || \ ARCH_WANT_FRAME_POINTERS default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS help@@ -771,13 +771,13 @@ config FAULT_INJECTION_STACKTRACE_FILTER depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on !X86_64 select STACKTRACE - select FRAME_POINTER if !PPC + select FRAME_POINTER help Provide stacktrace filter for fault-injection capabilities config LATENCYTOP bool "Latency measuring infrastructure" - select FRAME_POINTER if !MIPS && !PPC + select FRAME_POINTER if !MIPS select KALLSYMS select KALLSYMS_ALL select STACKTRACE
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Anton VorontsovQuoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.
But what about -pg -requires -fno-omit-frame-pointer ?
Ben.
Quoted 104 lines
Signed-off-by Anton Vorontsov <[email protected]>--- arch/powerpc/Makefile | 10 ++++++---- arch/powerpc/kernel/Makefile | 10 +++++----- arch/powerpc/platforms/powermac/Makefile | 2 +- lib/Kconfig.debug | 8 ++++---- 4 files changed, 16 insertions(+), 14 deletions(-)arch/powerpc/Makefile +6
-4@@ -120,10 +120,12 @@ ifeq ($(CONFIG_6xx),y) KBUILD_CFLAGS += -mcpu=powerpc endif -# Work around a gcc code-gen bug with -fno-omit-frame-pointer. -ifeq ($(CONFIG_FUNCTION_TRACER),y) -KBUILD_CFLAGS += -mno-sched-epilog -endif +# Remove -fno-omit-frame-pointer flag. There are two reasons: +# 1. On powerpc we always have frame pointers. +# 2. Some gcc versions might generate wrong code with -fno-omit-frame-pointer +# flag. So, if for some reason you're going to remove this line, then add +# -mno-sched-epilog to workaround the gcc bug. +KBUILD_CFLAGS := $(subst -fno-omit-frame-pointer,,$(KBUILD_CFLAGS)) cpu-as-$(CONFIG_4xx) += -Wa,-m405 cpu-as-$(CONFIG_6xx) += -Wa,-maltivecarch/powerpc/kernel/Makefile +5
-5@@ -14,14 +14,14 @@ endif ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_btext.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_cputable.o = -pg +CFLAGS_REMOVE_prom_init.o = -pg +CFLAGS_REMOVE_btext.o = -pg +CFLAGS_REMOVE_prom.o = -pg ifdef CONFIG_DYNAMIC_FTRACE # dynamic ftrace setup. -CFLAGS_REMOVE_ftrace.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_ftrace.o = -pg endif endifarch/powerpc/platforms/powermac/Makefile +1
-1@@ -2,7 +2,7 @@ CFLAGS_bootx_init.o += -fPIC ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_bootx_init.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_bootx_init.o = -pg endif obj-y += pic.o setup.o time.o feature.o pci.o \lib/Kconfig.debug +4
-4@@ -402,7 +402,7 @@ config LOCKDEP bool depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT select STACKTRACE - select FRAME_POINTER if !X86 && !MIPS && !PPC + select FRAME_POINTER if !X86 && !MIPS select KALLSYMS select KALLSYMS_ALL@@ -583,7 +583,7 @@ config FRAME_POINTER bool "Compile the kernel with frame pointers" depends on DEBUG_KERNEL && \ (CRIS || M68K || M68KNOMMU || FRV || UML || S390 || \ - AVR32 || SUPERH || BLACKFIN || MN10300) || \ + AVR32 || SUPERH || BLACKFIN || MN10300 || PPC) || \ ARCH_WANT_FRAME_POINTERS default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS help@@ -771,13 +771,13 @@ config FAULT_INJECTION_STACKTRACE_FILTER depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on !X86_64 select STACKTRACE - select FRAME_POINTER if !PPC + select FRAME_POINTER help Provide stacktrace filter for fault-injection capabilities config LATENCYTOP bool "Latency measuring infrastructure" - select FRAME_POINTER if !MIPS && !PPC + select FRAME_POINTER if !MIPS select KALLSYMS select KALLSYMS_ALL select STACKTRACE
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Anton VorontsovQuoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.
But what about -pg -requires -fno-omit-frame-pointer ?
Ben.
Quoted 104 lines
Signed-off-by Anton Vorontsov <[email protected]>--- arch/powerpc/Makefile | 10 ++++++---- arch/powerpc/kernel/Makefile | 10 +++++----- arch/powerpc/platforms/powermac/Makefile | 2 +- lib/Kconfig.debug | 8 ++++---- 4 files changed, 16 insertions(+), 14 deletions(-)arch/powerpc/Makefile +6
-4@@ -120,10 +120,12 @@ ifeq ($(CONFIG_6xx),y) KBUILD_CFLAGS += -mcpu=powerpc endif -# Work around a gcc code-gen bug with -fno-omit-frame-pointer. -ifeq ($(CONFIG_FUNCTION_TRACER),y) -KBUILD_CFLAGS += -mno-sched-epilog -endif +# Remove -fno-omit-frame-pointer flag. There are two reasons: +# 1. On powerpc we always have frame pointers. +# 2. Some gcc versions might generate wrong code with -fno-omit-frame-pointer +# flag. So, if for some reason you're going to remove this line, then add +# -mno-sched-epilog to workaround the gcc bug. +KBUILD_CFLAGS := $(subst -fno-omit-frame-pointer,,$(KBUILD_CFLAGS)) cpu-as-$(CONFIG_4xx) += -Wa,-m405 cpu-as-$(CONFIG_6xx) += -Wa,-maltivecarch/powerpc/kernel/Makefile +5
-5@@ -14,14 +14,14 @@ endif ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_btext.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_cputable.o = -pg +CFLAGS_REMOVE_prom_init.o = -pg +CFLAGS_REMOVE_btext.o = -pg +CFLAGS_REMOVE_prom.o = -pg ifdef CONFIG_DYNAMIC_FTRACE # dynamic ftrace setup. -CFLAGS_REMOVE_ftrace.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_ftrace.o = -pg endif endifarch/powerpc/platforms/powermac/Makefile +1
-1@@ -2,7 +2,7 @@ CFLAGS_bootx_init.o += -fPIC ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_bootx_init.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_bootx_init.o = -pg endif obj-y += pic.o setup.o time.o feature.o pci.o \lib/Kconfig.debug +4
-4@@ -402,7 +402,7 @@ config LOCKDEP bool depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT select STACKTRACE - select FRAME_POINTER if !X86 && !MIPS && !PPC + select FRAME_POINTER if !X86 && !MIPS select KALLSYMS select KALLSYMS_ALL@@ -583,7 +583,7 @@ config FRAME_POINTER bool "Compile the kernel with frame pointers" depends on DEBUG_KERNEL && \ (CRIS || M68K || M68KNOMMU || FRV || UML || S390 || \ - AVR32 || SUPERH || BLACKFIN || MN10300) || \ + AVR32 || SUPERH || BLACKFIN || MN10300 || PPC) || \ ARCH_WANT_FRAME_POINTERS default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS help@@ -771,13 +771,13 @@ config FAULT_INJECTION_STACKTRACE_FILTER depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on !X86_64 select STACKTRACE - select FRAME_POINTER if !PPC + select FRAME_POINTER help Provide stacktrace filter for fault-injection capabilities config LATENCYTOP bool "Latency measuring infrastructure" - select FRAME_POINTER if !MIPS && !PPC + select FRAME_POINTER if !MIPS select KALLSYMS select KALLSYMS_ALL select STACKTRACE
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Anton VorontsovQuoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.
But what about -pg -requires -fno-omit-frame-pointer ?
Ben.
Quoted 104 lines
Signed-off-by Anton Vorontsov <[email protected]>--- arch/powerpc/Makefile | 10 ++++++---- arch/powerpc/kernel/Makefile | 10 +++++----- arch/powerpc/platforms/powermac/Makefile | 2 +- lib/Kconfig.debug | 8 ++++---- 4 files changed, 16 insertions(+), 14 deletions(-)arch/powerpc/Makefile +6
-4@@ -120,10 +120,12 @@ ifeq ($(CONFIG_6xx),y) KBUILD_CFLAGS += -mcpu=powerpc endif -# Work around a gcc code-gen bug with -fno-omit-frame-pointer. -ifeq ($(CONFIG_FUNCTION_TRACER),y) -KBUILD_CFLAGS += -mno-sched-epilog -endif +# Remove -fno-omit-frame-pointer flag. There are two reasons: +# 1. On powerpc we always have frame pointers. +# 2. Some gcc versions might generate wrong code with -fno-omit-frame-pointer +# flag. So, if for some reason you're going to remove this line, then add +# -mno-sched-epilog to workaround the gcc bug. +KBUILD_CFLAGS := $(subst -fno-omit-frame-pointer,,$(KBUILD_CFLAGS)) cpu-as-$(CONFIG_4xx) += -Wa,-m405 cpu-as-$(CONFIG_6xx) += -Wa,-maltivecarch/powerpc/kernel/Makefile +5
-5@@ -14,14 +14,14 @@ endif ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_btext.o = -pg -mno-sched-epilog -CFLAGS_REMOVE_prom.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_cputable.o = -pg +CFLAGS_REMOVE_prom_init.o = -pg +CFLAGS_REMOVE_btext.o = -pg +CFLAGS_REMOVE_prom.o = -pg ifdef CONFIG_DYNAMIC_FTRACE # dynamic ftrace setup. -CFLAGS_REMOVE_ftrace.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_ftrace.o = -pg endif endifarch/powerpc/platforms/powermac/Makefile +1
-1@@ -2,7 +2,7 @@ CFLAGS_bootx_init.o += -fPIC ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code -CFLAGS_REMOVE_bootx_init.o = -pg -mno-sched-epilog +CFLAGS_REMOVE_bootx_init.o = -pg endif obj-y += pic.o setup.o time.o feature.o pci.o \lib/Kconfig.debug +4
-4@@ -402,7 +402,7 @@ config LOCKDEP bool depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT select STACKTRACE - select FRAME_POINTER if !X86 && !MIPS && !PPC + select FRAME_POINTER if !X86 && !MIPS select KALLSYMS select KALLSYMS_ALL@@ -583,7 +583,7 @@ config FRAME_POINTER bool "Compile the kernel with frame pointers" depends on DEBUG_KERNEL && \ (CRIS || M68K || M68KNOMMU || FRV || UML || S390 || \ - AVR32 || SUPERH || BLACKFIN || MN10300) || \ + AVR32 || SUPERH || BLACKFIN || MN10300 || PPC) || \ ARCH_WANT_FRAME_POINTERS default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS help@@ -771,13 +771,13 @@ config FAULT_INJECTION_STACKTRACE_FILTER depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on !X86_64 select STACKTRACE - select FRAME_POINTER if !PPC + select FRAME_POINTER help Provide stacktrace filter for fault-injection capabilities config LATENCYTOP bool "Latency measuring infrastructure" - select FRAME_POINTER if !MIPS && !PPC + select FRAME_POINTER if !MIPS select KALLSYMS select KALLSYMS_ALL select STACKTRACE
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Benjamin HerrenschmidtQuoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.But what about -pg -requires -fno-omit-frame-pointer ?
I don't think it requires -fno-omit-frame-pointer. It is just incompatible with -fomit-frame-pointer.
-- Steve
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
Quoted 10 lines · Steven Rostedt
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.But what about -pg -requires -fno-omit-frame-pointer ?
I don't think it requires -fno-omit-frame-pointer. It is just incompatible with -fomit-frame-pointer.
Yep, -fno-omit-frame-poiner isn't needed for -pg.
I explained this in http://lkml.org/lkml/2009/2/3/342 :
| 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".
That is,
gcc -O -pg -fno-omit-frame-pointer -S output:
main:
mflr 0
stw 0,4(1)
bl _mcount
stwu 1,-16(1)
mflr 0
stw 0,20(1)
stw 31,12(1)
mr 31,1
li 3,0
lwz 11,0(1)
lwz 0,4(11)
mtlr 0
lwz 31,-4(11)
mr 1,11
blr^^ -pg works (_mcount call), but r31 wasted.
Now gcc -O -pg -S output:
main:
mflr 0
stw 0,4(1)
bl _mcount
stwu 1,-16(1)
mflr 0
stw 0,20(1)
li 3,0
lwz 0,20(1)
mtlr 0
addi 1,1,16
blr^^ _mcount is still there, and r31 isn't used.
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Steven RostedtQuoted 11 lines · Steven Rostedt
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.But what about -pg -requires -fno-omit-frame-pointer ?
I don't think it requires -fno-omit-frame-pointer. It is just incompatible with -fomit-frame-pointer.
Quoted 1 line
From a quick test, you seem to be right.
Now the question of course is whether -pg will internally trigger the bug for which we need the workaround tho...
Ben.
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Steven RostedtQuoted 11 lines · Steven Rostedt
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.But what about -pg -requires -fno-omit-frame-pointer ?
I don't think it requires -fno-omit-frame-pointer. It is just incompatible with -fomit-frame-pointer.
From a quick test, you seem to be right.
Now the question of course is whether -pg will internally trigger the bug for which we need the workaround tho...
Ben.
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Steven RostedtQuoted 11 lines · Steven Rostedt
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.But what about -pg -requires -fno-omit-frame-pointer ?
I don't think it requires -fno-omit-frame-pointer. It is just incompatible with -fomit-frame-pointer.
From a quick test, you seem to be right.
Now the question of course is whether -pg will internally trigger the bug for which we need the workaround tho...
Ben.
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Steven RostedtQuoted 11 lines · Steven Rostedt
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.But what about -pg -requires -fno-omit-frame-pointer ?
I don't think it requires -fno-omit-frame-pointer. It is just incompatible with -fomit-frame-pointer.
From a quick test, you seem to be right.
Now the question of course is whether -pg will internally trigger the bug for which we need the workaround tho...
Ben.
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
In reply to Benjamin HerrenschmidtQuoted 8 lines · Benjamin Herrenschmidt
Quoted 7 lines · Steven Rostedt
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines · Anton Vorontsov
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.But what about -pg -requires -fno-omit-frame-pointer ?
Quoted 7 lines
Quoted 2 lines
I don't think it requires -fno-omit-frame-pointer. It is just incompatible with -fomit-frame-pointer.
From a quick test, you seem to be right.
Now the question of course is whether -pg will internally trigger the bug for which we need the workaround tho...
According to http://marc.info/?l=linux-kernel&m=121958694215835&w=4
just removing -fno-omit-frame-pointer solved the problem.
But I'll double check that on the actual hardware.
Thanks,
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 2/3] powerpc: Make it possible to safely select CONFIG_FRAME_POINTER
On Thu, Feb 05, 2009 at 04:30:23AM +0300, Anton Vorontsov wrote:
[...]
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Remove -fno-omit-frame-pointer flag from CFLAGS.
Remove -fno-omit-frame-pointer workarounds.But what about -pg -requires -fno-omit-frame-pointer ?
I don't think it requires -fno-omit-frame-pointer. It is just incompatible with -fomit-frame-pointer.
From a quick test, you seem to be right.
Quoted 7 lines
Quoted 2 lines
Now the question of course is whether -pg will internally trigger the bug for which we need the workaround tho...
According to http://marc.info/?l=linux-kernel&m=121958694215835&w=4
just removing -fno-omit-frame-pointer solved the problem.But I'll double check that on the actual hardware.
Confirmed. Just -pg doesn't cause any ill effects (for the test I built kernel on a ppc32 board).
While simply adding -fno-omit-frame-pointer caused this during bootup:
...
Waiting for /dev to be fully populated...
Unable to handle kernel paging request for data at address 0x00000901 Faulting instruction address: 0xc00d9a4c Oops: Kernel access of bad area, sig: 11 [#1] MPC837x RDB Modules linked in: NIP: c00d9a4c LR: c00d9a34 CTR: c015ac7c REGS: cf197cd0 TRAP: 0300 Not tainted (2.6.29-rc3-45527-g727839a-dirty) MSR: 00009032 <EE,ME,IR,DR> CR: 44084228 XER: 20000000 DAR: 00000901, DSISR: 22000000
TASK = cfa42a80[1140] 'udevd' THREAD: cf196000
GPR00: fffff000 cf197d80 cfa42a80 cf4213f0 c058e678 00000003 cf42145a 7f7f7f7f
GPR08: 0000012c 00000000 c0580000 cf197d80 84084228 1002414c cf197e9c c058e7b4
GPR16: c058e678 fffffff4 c05b0000 cf197dc0 cf197db8 cf197dc8 00000000 00000000
GPR24: c00e4e30 00000000 24084222 00000001 00000901 cf197e98 cf4213f0 cf197d80 NIP [c00d9a4c] do_lookup+0x7c/0xf8
LR [c00d9a34] do_lookup+0x64/0xf8
Call Trace:
[cf197d80] [c00d9a34] do_lookup+0x64/0xf8 (unreliable)
[cf197db0] [c00db73c] __link_path_walk+0x180/0xdc4
[cf197e30] [c00dc3d8] path_walk+0x58/0xe0
[cf197e60] [c00dc55c] do_path_lookup+0x8c/0x164
[cf197e90] [c00dd260] user_path_at+0x64/0xac
[cf197f00] [c00d3760] sys_readlinkat+0x40/0xb4
[cf197f30] [c00d380c] sys_readlink+0x38/0x50
[cf197f40] [c0018040] ret_from_syscall+0x0/0x38
--- Exception: c01 at 0xfed4754
LR = 0x10006280
Instruction dump:
80090000 2f800000 419e0028 7fa4eb78 7c0903a6 4e800421 7c7b1b79 40810040
3800f000 7fc3f378 7f9e0040 419d0018 <935c0000> 7f83e378 93dc0004 4bfffcd1
---[ end trace 4815c47675962320 ]---FWIW, gcc version 4.2.0.
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 10 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
Cheers,
Ben.
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 10 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
Cheers,
Ben.
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 10 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
Cheers,
Ben.
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 10 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
Cheers,
Ben.
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Benjamin HerrenschmidtQuoted 6 lines · Benjamin Herrenschmidt
Quoted 5 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)
Quoted 8 lines
Quoted 5 lines
-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
Well, toplevel Makefile changes are not to be taken lightly :-)
Looks good to me but it's handy to have Sam's Ack on it too.
Ingo
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
Quoted 12 lines · Ingo Molnar
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
Well, toplevel
Makefilechanges are not to be taken lightly :-)Looks good to me but it's handy to have Sam's Ack on it too.
Someone on IRC said that Sam is on vacation. This could take a while for an ACK.
-- Steve
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 12 lines · Ingo Molnar
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
Well, toplevel
Makefilechanges are not to be taken lightly :-)Looks good to me but it's handy to have Sam's Ack on it too.
Someone on IRC said that Sam is on vacation. This could take a while for an ACK.
-- Steve
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 12 lines · Ingo Molnar
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
Well, toplevel
Makefilechanges are not to be taken lightly :-)Looks good to me but it's handy to have Sam's Ack on it too.
Someone on IRC said that Sam is on vacation. This could take a while for an ACK.
-- Steve
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 12 lines · Ingo Molnar
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
Well, toplevel
Makefilechanges are not to be taken lightly :-)Looks good to me but it's handy to have Sam's Ack on it too.
Someone on IRC said that Sam is on vacation. This could take a while for an ACK.
-- Steve
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 28 lines · Ingo Molnar
Quoted 25 lines · Anton Vorontsov
This patch gives arches more freedom on overwriting CFLAGS, specifically on PowerPC we want to remove -fno-omit-frame-pointer flag.
Signed-off-by Anton Vorontsov <[email protected]>--- Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)Makefile +0
-2@@ -525,8 +525,6 @@ else KBUILD_CFLAGS += -O2 endif -include $(srctree)/arch/$(SRCARCH)/Makefile - ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif@@ -555,6 +553,8 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif
Quoted 8 lines
Makefile ifdef CONFIG_DEBUG_SECTION_MISMATCH · line 560
Quoted 6 lines
Makefile +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)this patch is really for Sam to judge - Cc:-ed him.
If we move the include further down then the following:
# Force gcc to behave correct even for buggy distributions # Arch Makefiles may override this setting KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
will most likely fail.
If popwerpc needs to get rid of "-fno-omit-frame-pointer" then we need a way to express this at KConfig level and NOT by doing some tricks with CFLAGS.
Sam
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Benjamin HerrenschmidtQuoted 6 lines · Benjamin Herrenschmidt
Quoted 5 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile isincluded
Quoted 1 line
NOSTDINC_FLAGS+= -nostdinc -isystem $(shell $(CC)
Quoted 8 lines
Quoted 5 lines
-print-file-name=include)
Quoted 2 lines
CHECKFLAGS += $(NOSTDINC_FLAGS)
this patch is really for Sam to judge - Cc:-ed him.
Sam ? I have a few more powerpc patches depending on that one... so I'd like to know if it's totally doomed or not :-)
See my answer to the mail from Ingo.
We really need to do this on Kconfig level it at all possible.
Sam
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Sam RavnborgQuoted 38 lines · Sam Ravnborg
Quoted 28 lines · Ingo Molnar
Quoted 25 lines · Anton Vorontsov
This patch gives arches more freedom on overwriting CFLAGS, specifically on PowerPC we want to remove -fno-omit-frame-pointer flag.
Signed-off-by Anton Vorontsov <[email protected]>--- Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)Makefile +0
-2@@ -525,8 +525,6 @@ else KBUILD_CFLAGS += -O2 endif -include $(srctree)/arch/$(SRCARCH)/Makefile - ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif@@ -555,6 +553,8 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endifQuoted 8 lines
Makefile ifdef CONFIG_DEBUG_SECTION_MISMATCH · line 560
Quoted 6 lines
Makefile +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)this patch is really for Sam to judge - Cc:-ed him.
Quoted 7 lines
If we move the include further down then the following:
# Force gcc to behave correct even for buggy distributions # Arch Makefiles may override this setting
KBUILD_CFLAGS+= $(call cc-option, -fno-stack-protector)will most likely fail.
ah, ok. (I long ago made the mental note of "dont change the toplevel Makefile if you can avoid it" - this reinforces that.)
Quoted 3 lines
If popwerpc needs to get rid of "-fno-omit-frame-pointer" then we need a way to express this at KConfig level and NOT by doing some tricks with CFLAGS.
Here is what we have in the toplevel Makefile at the moment:
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
KBUILD_CFLAGS += -fomit-frame-pointer
endif
My original suggestion (more than a week ago) was to make PPC always select FRAME_POINTERS.
It was pointed out that -fno-omit-frame-pointers (i.e.: generate frame pointers) not only makes the code less optimal on PPC, but it can also be miscompiled.
But instrumentation really needs to know whether __builtin_return_address(1) [etc] is reliable, whether stack tracing is fast - and other details - and PPC is the odd one out.
So the question is: even with FRAME_POINTERS disabled on PPC, is __builtin_return_address(1)/(2) reliable, and is save_stack_trace() fast? (i.e. can it walk down the stack frame efficiently, or does it have to scan the full kernel stack) I.e. does PPC have all the material advantages of frame pointers?
Ingo
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
Quoted 5 lines · Ingo Molnar
So the question is: even with
FRAME_POINTERSdisabled on PPC, is __builtin_return_address(1)/(2) reliable, and issave_stack_trace()fast? (i.e. can it walk down the stack frame efficiently, or does it have to scan the full kernel stack) I.e. does PPC have all the material advantages of frame pointers?
Yes, we do. We effectively have frame pointers in fact, they may only be omitted in leaf functions but then gcc __builtin_return_address() knows how to handle that afaik.
Cheers,
Ben.
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 5 lines · Ingo Molnar
So the question is: even with
FRAME_POINTERSdisabled on PPC, is __builtin_return_address(1)/(2) reliable, and issave_stack_trace()fast? (i.e. can it walk down the stack frame efficiently, or does it have to scan the full kernel stack) I.e. does PPC have all the material advantages of frame pointers?
Yes, we do. We effectively have frame pointers in fact, they may only be omitted in leaf functions but then gcc __builtin_return_address() knows how to handle that afaik.
Cheers,
Ben.
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 5 lines · Ingo Molnar
So the question is: even with
FRAME_POINTERSdisabled on PPC, is __builtin_return_address(1)/(2) reliable, and issave_stack_trace()fast? (i.e. can it walk down the stack frame efficiently, or does it have to scan the full kernel stack) I.e. does PPC have all the material advantages of frame pointers?
Yes, we do. We effectively have frame pointers in fact, they may only be omitted in leaf functions but then gcc __builtin_return_address() knows how to handle that afaik.
Cheers,
Ben.
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Ingo MolnarQuoted 5 lines · Ingo Molnar
So the question is: even with
FRAME_POINTERSdisabled on PPC, is __builtin_return_address(1)/(2) reliable, and issave_stack_trace()fast? (i.e. can it walk down the stack frame efficiently, or does it have to scan the full kernel stack) I.e. does PPC have all the material advantages of frame pointers?
Yes, we do. We effectively have frame pointers in fact, they may only be omitted in leaf functions but then gcc __builtin_return_address() knows how to handle that afaik.
Cheers,
Ben.
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Benjamin HerrenschmidtQuoted 10 lines · Benjamin Herrenschmidt
Quoted 5 lines · Ingo Molnar
So the question is: even with
FRAME_POINTERSdisabled on PPC, is __builtin_return_address(1)/(2) reliable, and issave_stack_trace()fast? (i.e. can it walk down the stack frame efficiently, or does it have to scan the full kernel stack) I.e. does PPC have all the material advantages of frame pointers?Yes, we do. We effectively have frame pointers in fact, they may only be omitted in leaf functions but then gcc
__builtin_return_address()knows how to handle that afaik.
So basically we want to define FRAME_POINTERS on PPC, but do not want the -fno-omit-frame-pointers flag.
Originally (many moons ago) FRAME_POINTER _was_ just the toplevel Makefile detail, but these days we've got a handful of secondary uses as well, expressing the reliability of backtraces in essence.
We could split the whole option (affecting lots of files), or we could zap that compiler flag in the PPC case - it is only PPC that worries about this anyway.
Ingo
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Sam RavnborgOn Sat, Feb 14, 2009 at 08:57:02PM +0100, Sam Ravnborg wrote:
[...]
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
Makefile +0
-2@@ -525,8 +525,6 @@ else KBUILD_CFLAGS += -O2 endif -include $(srctree)/arch/$(SRCARCH)/Makefile - ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif@@ -555,6 +553,8 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endifQuoted 8 lines
Makefile ifdef CONFIG_DEBUG_SECTION_MISMATCH · line 560
Quoted 6 lines
Makefile +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)this patch is really for Sam to judge - Cc:-ed him.
Quoted 7 lines
If we move the include further down then the following:
# Force gcc to behave correct even for buggy distributions # Arch Makefiles may override this setting
KBUILD_CFLAGS+= $(call cc-option, -fno-stack-protector)will most likely fail.
Hm... I don't get it, the comment says that the arch "may override this setting", but currently it may not, since arch makefile is included before this line. So my patch also fixes this "bug", no?
Or arches supposed to overwrite "cc-option" behaviour? Hm..
There is an interesting commit:
commit e06b8b98da071f7dd78fb7822991694288047df0
Author: Sam Ravnborg <[email protected]> Date: Wed Feb 13 22:43:28 2008 +0100
kbuild: allow -fstack-protector to take effect
[...]
Makefile +4 -3
@@ -507,6 +507,10 @@ else KBUILD_CFLAGS += -O2 endif +# Force gcc to behave correct even for buggy distributions +# Arch Makefiles may override this setting +KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) + include $(srctree)/arch/$(SRCARCH)/Makefile ifdef CONFIG_FRAME_POINTER
@@ -525,9 +529,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif -# Force gcc to behave correct even for buggy distributions -KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) - # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)
^^ Which does the same (wrt fno-stack-protector) as the patch I sent, i.e. includes arch Makefile later.
But then, this commit reverted things back (w/o your Ack):
commit bef5b54bd7bf8117c75cb943d64549134c6d9a1f
Author: Ralf Baechle <[email protected]> Date: Wed Jul 16 13:02:24 2008 +0100
Fix MIPS cross-compile problem
[...]
Makefile +2 -1
@@ -508,6 +508,8 @@ else KBUILD_CFLAGS += -O2 endif +include $(srctree)/arch/$(SRCARCH)/Makefile + ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif
@@ -516,8 +518,6 @@ endif # Arch Makefiles may override this setting KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) -include $(srctree)/arch/$(SRCARCH)/Makefile
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
Quoted 78 lines · Anton Vorontsov
On Sat, Feb 14, 2009 at 08:57:02PM +0100, Sam Ravnborg wrote:
[...]Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
Makefile +0
-2@@ -525,8 +525,6 @@ else KBUILD_CFLAGS += -O2 endif -include $(srctree)/arch/$(SRCARCH)/Makefile - ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif@@ -555,6 +553,8 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endifQuoted 8 lines
Makefile ifdef CONFIG_DEBUG_SECTION_MISMATCH · line 534
Quoted 6 lines
Makefile +2
-0+include $(srctree)/arch/$(SRCARCH)/Makefile + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)this patch is really for Sam to judge - Cc:-ed him.
Quoted 7 lines
If we move the include further down then the following:
# Force gcc to behave correct even for buggy distributions # Arch Makefiles may override this setting
KBUILD_CFLAGS+= $(call cc-option, -fno-stack-protector)will most likely fail.
Hm... I don't get it, the comment says that the arch "may override this setting", but currently it may not, since arch makefile is included before this line. So my patch also fixes this "bug", no?
Or arches supposed to overwrite "cc-option" behaviour? Hm..
There is an interesting commit:
commit
e06b8b98da071f7dd78fb7822991694288047df0Author: Sam Ravnborg <[email protected]> Date: Wed Feb 13 22:43:28 2008 +0100kbuild: allow -fstack-protector to take effect
[...]Makefile +4
-3@@ -507,6 +507,10 @@ else KBUILD_CFLAGS += -O2 endif +# Force gcc to behave correct even for buggy distributions +# Arch Makefiles may override this setting +KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) + include $(srctree)/arch/$(SRCARCH)/Makefile ifdef CONFIG_FRAME_POINTER@@ -525,9 +529,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif -# Force gcc to behave correct even for buggy distributions -KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) - # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)^^ Which does the same (wrt fno-stack-protector) as the patch I sent, i.e. includes arch
Makefilelater.But then, this commit reverted things back (w/o your Ack):
Quoted 8 lines
commit
bef5b54bd7bf8117c75cb943d64549134c6d9a1fAuthor: Ralf Baechle <[email protected]> Date: Wed Jul 16 13:02:24 2008 +0100Fix MIPS cross-compile problem
Ok, I think I got it. It seems that Ralf was using this feature of arch/mips/Makefile:
ifneq ($(SUBARCH),$(ARCH))
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-)
endif
endif
There are few arches that have "auto detection" of CROSS_COMPILE
variable: mips, m68k, parisc, xtensa, h8300 and blackfin.
So `normal' arches don't have any chance to overwrite the flags because of the few offenders above. ;-)
Quoted 21 lines
[...]
Makefile +2
-2@@ -508,6 +508,8 @@ else KBUILD_CFLAGS += -O2 endif +include $(srctree)/arch/$(SRCARCH)/Makefile + ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif@@ -516,8 +518,6 @@ endif # Arch Makefiles may override this setting KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) -include $(srctree)/arch/$(SRCARCH)/Makefile - ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls else
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Anton VorontsovOn Mon, Feb 16, 2009 at 05:20:01PM +0300, Anton Vorontsov wrote:
[...]
Quoted 24 lines
But then, this commit reverted things back (w/o your Ack):
commit
bef5b54bd7bf8117c75cb943d64549134c6d9a1fAuthor: Ralf Baechle <[email protected]> Date: Wed Jul 16 13:02:24 2008 +0100Fix MIPS cross-compile problem
[...]
Makefile +2
-0@@ -508,6 +508,8 @@ else KBUILD_CFLAGS += -O2 endif +include $(srctree)/arch/$(SRCARCH)/Makefile + ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif
Makefile endif · line 523
Quoted 8 lines
Makefile +0
-2@@ -516,8 +518,6 @@ endif # Arch Makefiles may override this setting KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) -include $(srctree)/arch/$(SRCARCH)/Makefile - ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls else
Btw, I wonder if x86's CONFIG_CC_STACKPROTECTOR is a no-op since v2.6.27-rc1? Seems like it is.
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
Quoted 29 lines · Anton Vorontsov
On Mon, Feb 16, 2009 at 05:20:01PM +0300, Anton Vorontsov wrote:
[...]Quoted 27 lines
But then, this commit reverted things back (w/o your Ack):
commit
bef5b54bd7bf8117c75cb943d64549134c6d9a1fAuthor: Ralf Baechle <[email protected]> Date: Wed Jul 16 13:02:24 2008 +0100Fix MIPS cross-compile problem
[...]
Makefile +2
-0@@ -508,6 +508,8 @@ else KBUILD_CFLAGS += -O2 endif +include $(srctree)/arch/$(SRCARCH)/Makefile + ifneq (CONFIG_FRAME_WARN,0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif@@ -516,8 +518,6 @@ endif # Arch Makefiles may override this setting KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
Quoted 8 lines
Makefile endif · line 523
Quoted 5 lines
Makefile +0
-2-include $(srctree)/arch/$(SRCARCH)/Makefile - ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls elseBtw, I wonder if x86's
CONFIG_CC_STACKPROTECTORis a no-op since v2.6.27-rc1? Seems like it is.
that's fixed and merged up for 2.6.30.
Ingo
Re: [PATCH 1/3] Makefile: Include arch Makefiles as late as possible
In reply to Anton VorontsovQuoted 6 lines
There are few arches that have "auto detection" of
CROSS_COMPILE
variable: mips, m68k, parisc, xtensa, h8300 and blackfin.So `normal' arches don't have any chance to overwrite the flags because of the few offenders above. ;-)
We also have archs where we add options to gcc that may impact for example -fno-stack-protector.
We had a bug in x86 in this area for a while.
So the only sane thing is to only add the most generic options to KBUILD_CFLAGS before we include the arch specific part. And we can then add the conditional options later - like the KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) in this case.
We learned a few lessons in this area over time as your history digging also showed.
Sam