Inter-revision diff: patch 4

Comparing v8 (message) to v6 (message)

--- v8
+++ v6
@@ -1,31 +1,22 @@
-  * arch/powerpc/Makefile:
-    - globally use -mprofile-kernel in case it's configured,
-      available and bug-free.
-  * arch/powerpc/gcc-mprofile-kernel-notrace.sh:
-    - make sure -mprofile-kernel works and has none of the
-      known bugs.
-  * arch/powerpc/kernel/ftrace.c:
-    - error out on compile with HAVE_DYNAMIC_FTRACE_WITH_REGS
-      and a buggy compiler.
+  * Makefile:
+    - globally use -mprofile-kernel in case it's configured
+      and available.
   * arch/powerpc/Kconfig / kernel/trace/Kconfig:
     - declare that ppc64le HAVE_MPROFILE_KERNEL and
       HAVE_DYNAMIC_FTRACE_WITH_REGS, and use it.
 
 Signed-off-by: Torsten Duwe <duwe@suse.de>
 ---
- arch/powerpc/Kconfig                        |  2 ++
- arch/powerpc/Makefile                       | 17 +++++++++++++++
- arch/powerpc/gcc-mprofile-kernel-notrace.sh | 33 +++++++++++++++++++++++++++++
- arch/powerpc/kernel/ftrace.c                |  5 +++++
- kernel/trace/Kconfig                        |  5 +++++
- 5 files changed, 62 insertions(+)
- create mode 100755 arch/powerpc/gcc-mprofile-kernel-notrace.sh
+ arch/powerpc/Kconfig  |  2 ++
+ arch/powerpc/Makefile | 10 ++++++++++
+ kernel/trace/Kconfig  |  5 +++++
+ 3 files changed, 17 insertions(+)
 
 diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
-index e4824fd..e5f288c 100644
+index db49e0d..89b1a2a 100644
 --- a/arch/powerpc/Kconfig
 +++ b/arch/powerpc/Kconfig
-@@ -94,8 +94,10 @@ config PPC
+@@ -97,8 +97,10 @@ config PPC
  	select OF_RESERVED_MEM
  	select HAVE_FTRACE_MCOUNT_RECORD
  	select HAVE_DYNAMIC_FTRACE
@@ -37,88 +28,26 @@
  	select ARCH_WANT_OPTIONAL_GPIOLIB
  	select VIRT_TO_BUS if !PPC64
 diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
-index 96efd82..08a3952 100644
+index 96efd82..2f9b527 100644
 --- a/arch/powerpc/Makefile
 +++ b/arch/powerpc/Makefile
-@@ -133,6 +133,23 @@ else
+@@ -133,6 +133,16 @@ else
  CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
  endif
  
 +ifeq ($(CONFIG_PPC64),y)
 +ifdef CONFIG_HAVE_MPROFILE_KERNEL
-+
-+ifdef CONFIG_DYNAMIC_FTRACE
-+ifeq ($(shell $(CONFIG_SHELL) $(srctree)/arch/powerpc/gcc-mprofile-kernel-notrace.sh $(CC) -I$(srctree)/include -D__KERNEL__), y)
-+CC_USING_MPROFILE_KERNEL := -mprofile-kernel
-+endif
-+endif
-+
++CC_USING_MPROFILE_KERNEL := $(call cc-option,-mprofile-kernel)
 +ifdef CC_USING_MPROFILE_KERNEL
 +CC_FLAGS_FTRACE	:= -pg $(CC_USING_MPROFILE_KERNEL)
 +KBUILD_CPPFLAGS	+= -DCC_USING_MPROFILE_KERNEL
 +endif
-+
 +endif
 +endif
 +
  CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell)
  CFLAGS-$(CONFIG_POWER4_CPU) += $(call cc-option,-mcpu=power4)
  CFLAGS-$(CONFIG_POWER5_CPU) += $(call cc-option,-mcpu=power5)
-diff --git a/arch/powerpc/gcc-mprofile-kernel-notrace.sh b/arch/powerpc/gcc-mprofile-kernel-notrace.sh
-new file mode 100755
-index 0000000..68d6482
---- /dev/null
-+++ b/arch/powerpc/gcc-mprofile-kernel-notrace.sh
-@@ -0,0 +1,33 @@
-+#!/bin/sh
-+# Test whether the compile option -mprofile-kernel
-+# generates profiling code ( = a call to mcount), and
-+# whether a function without any global references sets
-+# the TOC pointer properly at the beginning, and
-+# whether the "notrace" function attribute successfully
-+# suppresses the _mcount call.
-+
-+echo "int func() { return 0; }" | \
-+    $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \
-+    grep -q "mcount"
-+
-+trace_result=$?
-+
-+echo "int func() { return 0; }" | \
-+    $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \
-+    sed -n -e '/func:/,/bl _mcount/p' | grep -q TOC
-+
-+leaf_toc_result=$?
-+
-+/bin/echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \
-+    $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \
-+    grep -q "mcount"
-+
-+notrace_result=$?
-+
-+if [ "$trace_result" -eq "0" -a \
-+	"$leaf_toc_result" -eq "0" -a \
-+	"$notrace_result" -eq "1" ]; then
-+	echo y
-+else
-+	echo n
-+fi
-diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
-index ef8b916..29b7014 100644
---- a/arch/powerpc/kernel/ftrace.c
-+++ b/arch/powerpc/kernel/ftrace.c
-@@ -28,6 +28,11 @@
- 
- 
- #ifdef CONFIG_DYNAMIC_FTRACE
-+#if defined(CONFIG_DYNAMIC_FTRACE_WITH_REGS) && defined(CONFIG_PPC64) && \
-+  !defined(CC_USING_MPROFILE_KERNEL)
-+#error "DYNAMIC_FTRACE_WITH_REGS requires working -mprofile-kernel"
-+#endif
-+
- static unsigned int
- ftrace_call_replace(unsigned long ip, unsigned long addr, int link)
- {
 diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
 index e45db6b..a138f6d 100644
 --- a/kernel/trace/Kconfig
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help