mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty
@ 2010-10-18 18:53 Steven Rostedt
  2010-10-18 19:13 ` [RFC] better fix? (was: Re: [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty) Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2010-10-18 18:53 UTC (permalink / raw)
  To: LKML
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Michal Marek,
	linux-kbuild, Sam Ravnborg


Ingo,

Please pull the latest tip/perf/recordmcount tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/perf/recordmcount


Steven Rostedt (1):
      ftrace: Remove recursion between recordmcount and scripts/mod/empty

----
 scripts/Makefile.build |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---------------------------
commit 0ae78b8f70eccd69febf70c688d15ae1253303e0
Author: Steven Rostedt <srostedt@redhat.com>
Date:   Mon Oct 18 14:42:00 2010 -0400

    ftrace: Remove recursion between recordmcount and scripts/mod/empty
    
    When DYNAMIC_FTRACE is enabled and we use the C version of recordmcount,
    all objects are run through the recordmcount program to create a
    separate section that stores all the callers of mcount.
    
    The build process has a special file: scripts/mod/empty.o. This is
    built from empty.c which is literally an empty file (except for a
    single comment). This file is used to find information about the target
    elf format, like endianness and word size.
    
    The problem comes up when we need to build recordmcount. The
    build process requires that empty.o is built first. The build rules
    for empty.o will try to execute recordmcount on the empty.o file.
    We get an error that recordmcount does not exist.
    
    To avoid this recursion, the build file will skip running recordmcount
    if the file that it is building is script/mod/empty.o.
    
    Perhaps a new rule is needed, or we may open-code empty.o build.
    
    Reported-by: Ingo Molnar <mingo@elte.hu>
    Tested-by: Ingo Molnar <mingo@elte.hu>
    Cc: Michal Marek <mmarek@suse.cz>
    Cc: linux-kbuild@vger.kernel.org
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 4db60b2..9f2d5b4 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -210,7 +210,11 @@ endif
 
 ifdef CONFIG_FTRACE_MCOUNT_RECORD
 ifdef BUILD_C_RECORDMCOUNT
-cmd_record_mcount = $(objtree)/scripts/recordmcount "$(@)";
+# Due to recursion, we must skip the empty.o file
+#  TBD: Find a better way to do this.
+cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then			\
+			$(objtree)/scripts/recordmcount "$(@)";			\
+		    fi;
 else
 cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
 	"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC] better fix? (was: Re: [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty)
  2010-10-18 18:53 [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty Steven Rostedt
@ 2010-10-18 19:13 ` Steven Rostedt
  2010-10-18 19:35   ` Sam Ravnborg
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2010-10-18 19:13 UTC (permalink / raw)
  To: LKML
  Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Michal Marek,
	linux-kbuild, Sam Ravnborg

On Mon, 2010-10-18 at 14:53 -0400, Steven Rostedt wrote:

Just calling attention to this...

> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 4db60b2..9f2d5b4 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -210,7 +210,11 @@ endif
>  
>  ifdef CONFIG_FTRACE_MCOUNT_RECORD
>  ifdef BUILD_C_RECORDMCOUNT
> -cmd_record_mcount = $(objtree)/scripts/recordmcount "$(@)";
> +# Due to recursion, we must skip the empty.o file
> +#  TBD: Find a better way to do this.
> +cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then			\
> +			$(objtree)/scripts/recordmcount "$(@)";			\
> +		    fi;
>  else
>  cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
>  	"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
> 

This is pretty much a hack, would adding a patch like the following be a
better idea?

-- Steve

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 9f2d5b4..86e360a 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -210,11 +210,7 @@ endif
 
 ifdef CONFIG_FTRACE_MCOUNT_RECORD
 ifdef BUILD_C_RECORDMCOUNT
-# Due to recursion, we must skip the empty.o file
-#  TBD: Find a better way to do this.
-cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then			\
-			$(objtree)/scripts/recordmcount "$(@)";			\
-		    fi;
+cmd_record_mcount = $(objtree)/scripts/recordmcount "$(@)";
 else
 cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
 	"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
@@ -236,11 +232,26 @@ define rule_cc_o_c
 	mv -f $(dot-target).tmp $(dot-target).cmd
 endef
 
+define rule_cc_o_c_notrace
+	$(call echo-cmd,checksrc) $(cmd_checksrc)			  \
+	$(call echo-cmd,cc_o_c) $(cmd_cc_o_c);				  \
+	$(cmd_modversions)						  \
+	scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' >    \
+	                                              $(dot-target).tmp;  \
+	rm -f $(depfile);						  \
+	mv -f $(dot-target).tmp $(dot-target).cmd
+endef
+
 # Built-in and composite module parts
 $(obj)/%.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
 	$(call if_changed_rule,cc_o_c)
 
+# Due to recursion, recordmcount must not be called on empty.o
+$(objtree)/scripts/mod/empty.o: $(srctree)/scripts/mod/empty.c
+	$(call cmd,force_checksrc)
+	$(call if_changed_rule,cc_o_c_notrace)
+
 # Single-part modules are special since we need to mark them in $(MODVERDIR)
 
 $(single-used-m): $(obj)/%.o: $(src)/%.c FORCE



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] better fix? (was: Re: [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty)
  2010-10-18 19:13 ` [RFC] better fix? (was: Re: [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty) Steven Rostedt
@ 2010-10-18 19:35   ` Sam Ravnborg
  2010-10-18 21:03     ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2010-10-18 19:35 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Ingo Molnar, Frederic Weisbecker, Andrew Morton,
	Michal Marek, linux-kbuild

On Mon, Oct 18, 2010 at 03:13:26PM -0400, Steven Rostedt wrote:
> On Mon, 2010-10-18 at 14:53 -0400, Steven Rostedt wrote:
> 
> Just calling attention to this...
> 
> > diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> > index 4db60b2..9f2d5b4 100644
> > --- a/scripts/Makefile.build
> > +++ b/scripts/Makefile.build
> > @@ -210,7 +210,11 @@ endif
> >  
> >  ifdef CONFIG_FTRACE_MCOUNT_RECORD
> >  ifdef BUILD_C_RECORDMCOUNT
> > -cmd_record_mcount = $(objtree)/scripts/recordmcount "$(@)";
> > +# Due to recursion, we must skip the empty.o file
> > +#  TBD: Find a better way to do this.
> > +cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then			\
> > +			$(objtree)/scripts/recordmcount "$(@)";			\
> > +		    fi;
> >  else
> >  cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
> >  	"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
> > 
> 
> This is pretty much a hack, would adding a patch like the following be a
> better idea?

I prefer the hack above...
It is obvious what it does. And the hack is simple.

An additional comment about the origin of empty.o is needed.
Only very few people knows that we generate empty.o in scripts/

	Sam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] better fix? (was: Re: [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty)
  2010-10-18 19:35   ` Sam Ravnborg
@ 2010-10-18 21:03     ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2010-10-18 21:03 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: LKML, Ingo Molnar, Frederic Weisbecker, Andrew Morton,
	Michal Marek, linux-kbuild

On Mon, 2010-10-18 at 21:35 +0200, Sam Ravnborg wrote:

> An additional comment about the origin of empty.o is needed.
> Only very few people knows that we generate empty.o in scripts/

OK, how are you with this comment?

# Due to recursion, we must skip the empty.o file.
# The empty.o file is created in the make process in order
#  to determine the target endianness and word size.
#  It is made before all other C files, including recordmcount.

-- Steve



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-18 21:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-18 18:53 [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty Steven Rostedt
2010-10-18 19:13 ` [RFC] better fix? (was: Re: [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty) Steven Rostedt
2010-10-18 19:35   ` Sam Ravnborg
2010-10-18 21:03     ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®