public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Resend of ftrace recordmcount.pl fixes
@ 2009-08-04  6:06 Matt Fleming
  2009-08-04  6:06 ` [PATCH 1/2] ftrace: Fix the conditional that updates $ref_func Matt Fleming
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Matt Fleming @ 2009-08-04  6:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Paul Mundt, Ingo Molnar, Thomas Gelixner

I'm resending these two patches as they seem to be stalled.

Matt Fleming (2):
  ftrace: Fix the conditional that updates $ref_func
  ftrace: Only update $offset when we update $ref_func

 scripts/recordmcount.pl |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


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

* [PATCH 1/2] ftrace: Fix the conditional that updates $ref_func
  2009-08-04  6:06 [PATCH 0/2] Resend of ftrace recordmcount.pl fixes Matt Fleming
@ 2009-08-04  6:06 ` Matt Fleming
  2009-08-04  6:06 ` [PATCH 2/2] ftrace: Only update $offset when we update $ref_func Matt Fleming
  2009-08-04  8:06 ` [PATCH 0/2] Resend of ftrace recordmcount.pl fixes Ingo Molnar
  2 siblings, 0 replies; 5+ messages in thread
From: Matt Fleming @ 2009-08-04  6:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Paul Mundt, Ingo Molnar, Thomas Gelixner

Fix the conditional that checks if we already have a $ref_func and that
the new function is weak. The code as previously checking whether either
condition was false, and we really need to only update $ref_func is both
cconditions are false.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
---
 scripts/recordmcount.pl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 7109e2b..16c5563 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -414,7 +414,7 @@ while (<IN>) {
 	    $read_function = 0;
 	} else {
 	    # if we already have a function, and this is weak, skip it
-	    if (!defined($ref_func) || !defined($weak{$text})) {
+	    if (!defined($ref_func) && !defined($weak{$text})) {
 		$ref_func = $text;
 	    }
 	}
-- 
1.6.4.rc0


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

* [PATCH 2/2] ftrace: Only update $offset when we update $ref_func
  2009-08-04  6:06 [PATCH 0/2] Resend of ftrace recordmcount.pl fixes Matt Fleming
  2009-08-04  6:06 ` [PATCH 1/2] ftrace: Fix the conditional that updates $ref_func Matt Fleming
@ 2009-08-04  6:06 ` Matt Fleming
  2009-08-04  8:06 ` [PATCH 0/2] Resend of ftrace recordmcount.pl fixes Ingo Molnar
  2 siblings, 0 replies; 5+ messages in thread
From: Matt Fleming @ 2009-08-04  6:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Paul Mundt, Ingo Molnar, Thomas Gelixner

The value of $offset should be the offset of $ref_func from the
beginning of the object file. Therefore, we should set both variables
together.

This fixes a bug I was hitting on sh where $offset (which is used to
calcualte the addends for the __mcount_loc entries) was being set
multiple times and didn't correspond to $ref_func's offset in the object
file. The addends in __mcount_loc were calculated incorrectly, resulting
in ftrace dynamically modifying addresses that weren't mcount call
sites.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
---
 scripts/recordmcount.pl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 16c5563..d29baa2 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -403,7 +403,6 @@ while (<IN>) {
     # section found, now is this a start of a function?
     } elsif ($read_function && /$function_regex/) {
 	$text_found = 1;
-	$offset = hex $1;
 	$text = $2;
 
 	# if this is either a local function or a weak function
@@ -412,10 +411,12 @@ while (<IN>) {
 	if (!defined($locals{$text}) && !defined($weak{$text})) {
 	    $ref_func = $text;
 	    $read_function = 0;
+	    $offset = hex $1;
 	} else {
 	    # if we already have a function, and this is weak, skip it
 	    if (!defined($ref_func) && !defined($weak{$text})) {
 		$ref_func = $text;
+		$offset = hex $1;
 	    }
 	}
     } elsif ($read_headers && /$mcount_section/) {
-- 
1.6.4.rc0


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

* Re: [PATCH 0/2] Resend of ftrace recordmcount.pl fixes
  2009-08-04  6:06 [PATCH 0/2] Resend of ftrace recordmcount.pl fixes Matt Fleming
  2009-08-04  6:06 ` [PATCH 1/2] ftrace: Fix the conditional that updates $ref_func Matt Fleming
  2009-08-04  6:06 ` [PATCH 2/2] ftrace: Only update $offset when we update $ref_func Matt Fleming
@ 2009-08-04  8:06 ` Ingo Molnar
  2009-08-04  8:14   ` Matt Fleming
  2 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2009-08-04  8:06 UTC (permalink / raw)
  To: Matt Fleming; +Cc: linux-kernel, Steven Rostedt, Paul Mundt, Thomas Gelixner


* Matt Fleming <matt@console-pimps.org> wrote:

> I'm resending these two patches as they seem to be stalled.
> 
> Matt Fleming (2):
>   ftrace: Fix the conditional that updates $ref_func
>   ftrace: Only update $offset when we update $ref_func
> 
>  scripts/recordmcount.pl |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)

Applied to tip:tracing/urgent, thanks Matt!

	Ingo

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

* Re: [PATCH 0/2] Resend of ftrace recordmcount.pl fixes
  2009-08-04  8:06 ` [PATCH 0/2] Resend of ftrace recordmcount.pl fixes Ingo Molnar
@ 2009-08-04  8:14   ` Matt Fleming
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Fleming @ 2009-08-04  8:14 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Steven Rostedt, Paul Mundt, Thomas Gelixner

On Tue, Aug 04, 2009 at 10:06:02AM +0200, Ingo Molnar wrote:
> 
> * Matt Fleming <matt@console-pimps.org> wrote:
> 
> > I'm resending these two patches as they seem to be stalled.
> > 
> > Matt Fleming (2):
> >   ftrace: Fix the conditional that updates $ref_func
> >   ftrace: Only update $offset when we update $ref_func
> > 
> >  scripts/recordmcount.pl |    5 +++--
> >  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> Applied to tip:tracing/urgent, thanks Matt!
> 
> 	Ingo

Thank you!

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

end of thread, other threads:[~2009-08-04  8:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-04  6:06 [PATCH 0/2] Resend of ftrace recordmcount.pl fixes Matt Fleming
2009-08-04  6:06 ` [PATCH 1/2] ftrace: Fix the conditional that updates $ref_func Matt Fleming
2009-08-04  6:06 ` [PATCH 2/2] ftrace: Only update $offset when we update $ref_func Matt Fleming
2009-08-04  8:06 ` [PATCH 0/2] Resend of ftrace recordmcount.pl fixes Ingo Molnar
2009-08-04  8:14   ` Matt Fleming

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