* [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace
@ 2008-05-15 1:30 Steven Rostedt
2008-05-15 1:30 ` [PATCH 1/4] kbuild: Create new CFLAGS_REMOVE_(basename).o option Steven Rostedt
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Steven Rostedt @ 2008-05-15 1:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: David Miller, linux-kernel, pq, proski, sandmann, a.p.zijlstra,
linux-kbuild, zippel
Recently David Miller ported ftrace over to the sparc64. When I mentioned
to him a way to remove the "notrace" from all the functions in some
files done by using a dirty little hack, David (correctly) called it
"Makefile turd" and told us to stop doing that.
I then asked if a CFLAGS_REMOVE_foo.o = -pg would be more pleasing, and he
agreed.
This patch series starts out by creating a CFLAGS_REMOVE_(basetarget).o
that removes options from CFLAGS to compile a target file.
The rest of the patches clean up the Makefile turd with this variant.
Note, I left the turd in the trace directory itself, just because (almost)
all the files there should not be traced. But that's a special directory,
and this patch series keeps the sewage in one place.
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] kbuild: Create new CFLAGS_REMOVE_(basename).o option
2008-05-15 1:30 [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace Steven Rostedt
@ 2008-05-15 1:30 ` Steven Rostedt
2008-05-15 1:30 ` [PATCH 2/4] ftrace: use the new kbuild CFLAGS_REMOVE for kernel directory Steven Rostedt
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2008-05-15 1:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: David Miller, linux-kernel, pq, proski, sandmann, a.p.zijlstra,
linux-kbuild, zippel, Steven Rostedt
[-- Attachment #1: kbuild-add-cflags-remove.patch --]
[-- Type: text/plain, Size: 1851 bytes --]
We currently have a way to add special CFLAGS to code, but we do not have a
way to remove them if needed.
With the case of ftrace, some files should simply not be profiled. Adding
the -pg flag to these files is simply a waste, and adding "notrace" to each
and every function is ugly.
Currently we put in "Makefile turd" [1] to stop the compiler from adding -pg
to certain files. This was clumsy and awkward.
This patch now adds the revese of CFLAGS_(basename).o with
CFLAGS_REMOVE_(basename).o. This allows developers to prevent certain
CFLAGS from being used to compile files. For example, we can now do
CFLAGS_REMOVE_string.o = -pg
to remove the -pg option from the string.o file in the lib directory.
Note: a space delimited list of options may be added to the REMOVE macro.
[1] - what David Miller called the workaronud to remove -pg
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
scripts/Makefile.lib | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: linux-sched-devel.git/scripts/Makefile.lib
===================================================================
--- linux-sched-devel.git.orig/scripts/Makefile.lib 2008-05-14 18:12:22.000000000 -0700
+++ linux-sched-devel.git/scripts/Makefile.lib 2008-05-14 18:12:26.000000000 -0700
@@ -96,7 +96,8 @@ basename_flags = -D"KBUILD_BASENAME=KBUI
modname_flags = $(if $(filter 1,$(words $(modname))),\
-D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
-_c_flags = $(KBUILD_CFLAGS) $(ccflags-y) $(CFLAGS_$(basetarget).o)
+orig_c_flags = $(KBUILD_CFLAGS) $(ccflags-y) $(CFLAGS_$(basetarget).o)
+_c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags))
_a_flags = $(KBUILD_AFLAGS) $(asflags-y) $(AFLAGS_$(basetarget).o)
_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] ftrace: use the new kbuild CFLAGS_REMOVE for kernel directory
2008-05-15 1:30 [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace Steven Rostedt
2008-05-15 1:30 ` [PATCH 1/4] kbuild: Create new CFLAGS_REMOVE_(basename).o option Steven Rostedt
@ 2008-05-15 1:30 ` Steven Rostedt
2008-05-15 1:30 ` [PATCH 3/4] ftrace: use the new kbuild CFLAGS_REMOVE for lib directory Steven Rostedt
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2008-05-15 1:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: David Miller, linux-kernel, pq, proski, sandmann, a.p.zijlstra,
linux-kbuild, zippel, Steven Rostedt
[-- Attachment #1: ftrace-cflags-remove-kernel.patch --]
[-- Type: text/plain, Size: 1298 bytes --]
This patch removes the Makefile turd and uses the nice CFLAGS_REMOVE macro
in the kernel directory.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/Makefile | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
Index: linux-sched-devel.git/kernel/Makefile
===================================================================
--- linux-sched-devel.git.orig/kernel/Makefile 2008-05-14 18:22:29.000000000 -0700
+++ linux-sched-devel.git/kernel/Makefile 2008-05-14 18:22:34.000000000 -0700
@@ -11,12 +11,16 @@ obj-y = sched.o fork.o exec_domain.o
hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
notifier.o ksysfs.o pm_qos_params.o sched_clock.o
+CFLAGS_REMOVE_sched.o = -pg -mno-spe
+
ifdef CONFIG_FTRACE
-# Do not profile debug utilities
-ORIG_CFLAGS := $(KBUILD_CFLAGS)
-KBUILD_CFLAGS = $(if $(filter-out lockdep% %debug sched_clock,$(basename $(notdir $@))), \
- $(ORIG_CFLAGS), \
- $(subst -pg,,$(ORIG_CFLAGS)))
+# Do not trace debug files and internal ftrace files
+CFLAGS_REMOVE_lockdep.o = -pg
+CFLAGS_REMOVE_lockdep_proc.o = -pg
+CFLAGS_REMOVE_mutex-debug.o = -pg
+CFLAGS_REMOVE_rtmutex-debug.o = -pg
+CFLAGS_REMOVE_cgroup-debug.o = -pg
+CFLAGS_REMOVE_sched_clock.o = -pg
endif
obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] ftrace: use the new kbuild CFLAGS_REMOVE for lib directory
2008-05-15 1:30 [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace Steven Rostedt
2008-05-15 1:30 ` [PATCH 1/4] kbuild: Create new CFLAGS_REMOVE_(basename).o option Steven Rostedt
2008-05-15 1:30 ` [PATCH 2/4] ftrace: use the new kbuild CFLAGS_REMOVE for kernel directory Steven Rostedt
@ 2008-05-15 1:30 ` Steven Rostedt
2008-05-15 1:30 ` [PATCH 4/4] ftrace: use the new kbuild CFLAGS_REMOVE for x86/kernel directory Steven Rostedt
2008-05-15 9:02 ` [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace Andi Kleen
4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2008-05-15 1:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: David Miller, linux-kernel, pq, proski, sandmann, a.p.zijlstra,
linux-kbuild, zippel, Steven Rostedt
[-- Attachment #1: ftrace-cflags-remove-lib.patch --]
[-- Type: text/plain, Size: 1052 bytes --]
This patch removes the Makefile turd and uses the nice CFLAGS_REMOVE macro
in the lib directory.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
lib/Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: linux-sched-devel.git/lib/Makefile
===================================================================
--- linux-sched-devel.git.orig/lib/Makefile 2008-05-14 18:24:01.000000000 -0700
+++ linux-sched-devel.git/lib/Makefile 2008-05-14 18:24:13.000000000 -0700
@@ -10,11 +10,11 @@ lib-y := ctype.o string.o vsprintf.o cmd
ifdef CONFIG_FTRACE
# Do not profile string.o, since it may be used in early boot or vdso
+CFLAGS_REMOVE_string.o = -pg
# Also do not profile any debug utilities
-ORIG_CFLAGS := $(KBUILD_CFLAGS)
-KBUILD_CFLAGS = $(if $(filter-out %debug debug% string%,$(basename $(notdir $@))), \
- $(ORIG_CFLAGS), \
- $(subst -pg,,$(ORIG_CFLAGS)))
+CFLAGS_REMOVE_spinlock_debug.o = -pg
+CFLAGS_REMOVE_list_debug.o = -pg
+CFLAGS_REMOVE_debugobjects.o = -pg
endif
lib-$(CONFIG_MMU) += ioremap.o
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] ftrace: use the new kbuild CFLAGS_REMOVE for x86/kernel directory
2008-05-15 1:30 [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace Steven Rostedt
` (2 preceding siblings ...)
2008-05-15 1:30 ` [PATCH 3/4] ftrace: use the new kbuild CFLAGS_REMOVE for lib directory Steven Rostedt
@ 2008-05-15 1:30 ` Steven Rostedt
2008-05-15 9:02 ` [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace Andi Kleen
4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2008-05-15 1:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: David Miller, linux-kernel, pq, proski, sandmann, a.p.zijlstra,
linux-kbuild, zippel, Steven Rostedt
[-- Attachment #1: ftrace-cflags-remove-x86.patch --]
[-- Type: text/plain, Size: 939 bytes --]
This patch removes the Makefile turd and uses the nice CFLAGS_REMOVE macro
in the x86/kernel directory.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
arch/x86/kernel/Makefile | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Index: linux-sched-devel.git/arch/x86/kernel/Makefile
===================================================================
--- linux-sched-devel.git.orig/arch/x86/kernel/Makefile 2008-05-14 18:12:21.000000000 -0700
+++ linux-sched-devel.git/arch/x86/kernel/Makefile 2008-05-14 18:24:43.000000000 -0700
@@ -8,10 +8,9 @@ CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
ifdef CONFIG_FTRACE
# Do not profile debug utilities
-ORIG_CFLAGS := $(KBUILD_CFLAGS)
-KBUILD_CFLAGS = $(if $(filter-out tsc_64 tsc_32 rtc,$(basename $(notdir $@))), \
- $(ORIG_CFLAGS), \
- $(subst -pg,,$(ORIG_CFLAGS)))
+CFLAGS_REMOVE_tsc_64.o = -pg
+CFLAGS_REMOVE_tsc_32.o = -pg
+CFLAGS_REMOVE_rtc.o = -pg
endif
#
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace
2008-05-15 1:30 [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace Steven Rostedt
` (3 preceding siblings ...)
2008-05-15 1:30 ` [PATCH 4/4] ftrace: use the new kbuild CFLAGS_REMOVE for x86/kernel directory Steven Rostedt
@ 2008-05-15 9:02 ` Andi Kleen
4 siblings, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2008-05-15 9:02 UTC (permalink / raw)
To: Steven Rostedt
Cc: Ingo Molnar, David Miller, linux-kernel, pq, proski, sandmann,
a.p.zijlstra, linux-kbuild, zippel
Steven Rostedt <rostedt@goodmis.org> writes:
> Recently David Miller ported ftrace over to the sparc64. When I mentioned
> to him a way to remove the "notrace" from all the functions in some
> files done by using a dirty little hack, David (correctly) called it
> "Makefile turd" and told us to stop doing that.
>
> I then asked if a CFLAGS_REMOVE_foo.o = -pg would be more pleasing, and he
> agreed.
Very nice. You should use that for the scheduler case to get rid of
"-fno-omit-frame-pointer"
-Andi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-05-15 9:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-15 1:30 [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace Steven Rostedt
2008-05-15 1:30 ` [PATCH 1/4] kbuild: Create new CFLAGS_REMOVE_(basename).o option Steven Rostedt
2008-05-15 1:30 ` [PATCH 2/4] ftrace: use the new kbuild CFLAGS_REMOVE for kernel directory Steven Rostedt
2008-05-15 1:30 ` [PATCH 3/4] ftrace: use the new kbuild CFLAGS_REMOVE for lib directory Steven Rostedt
2008-05-15 1:30 ` [PATCH 4/4] ftrace: use the new kbuild CFLAGS_REMOVE for x86/kernel directory Steven Rostedt
2008-05-15 9:02 ` [PATCH 0/4] Create a CFLAGS_REMOVE for ftrace Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox