All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-arch@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>, H.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 2/4] x86 mcount offset calculation
Date: Tue, 10 May 2011 10:10:41 +0200	[thread overview]
Message-ID: <20110510081103.363216850@de.ibm.com> (raw)
In-Reply-To: 20110510081039.241831019@de.ibm.com

[-- Attachment #1: 301-mcount-adjust-x86.diff --]
[-- Type: text/plain, Size: 2790 bytes --]

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

Do the mcount offset adjustment in the recordmcount.pl/recordmcount.[ch]
at compile time and not in ftrace_call_adjust at run time.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---


 arch/x86/include/asm/ftrace.h |    7 +++----
 scripts/recordmcount.c        |   10 ++++++++--
 scripts/recordmcount.pl       |    2 ++
 3 files changed, 13 insertions(+), 6 deletions(-)
Index: test-2.6/arch/x86/include/asm/ftrace.h
===================================================================
--- test-2.6.orig/arch/x86/include/asm/ftrace.h	2009-09-12 09:47:14.000000000 +0200
+++ test-2.6/arch/x86/include/asm/ftrace.h	2011-05-03 09:39:02.145472579 +0200
@@ -38,11 +38,10 @@
 static inline unsigned long ftrace_call_adjust(unsigned long addr)
 {
 	/*
-	 * call mcount is "e8 <4 byte offset>"
-	 * The addr points to the 4 byte offset and the caller of this
-	 * function wants the pointer to e8. Simply subtract one.
+	 * addr is the address of the mcount call instruction.
+	 * recordmcount does the necessary offset calculation.
 	 */
-	return addr - 1;
+	return addr;
 }
 
 #ifdef CONFIG_DYNAMIC_FTRACE
Index: test-2.6/scripts/recordmcount.c
===================================================================
--- test-2.6.orig/scripts/recordmcount.c	2011-03-16 09:26:43.006913981 +0100
+++ test-2.6/scripts/recordmcount.c	2011-05-03 09:39:02.145472579 +0200
@@ -300,7 +300,10 @@
 			w2(ehdr->e_machine), fname);
 		fail_file();
 	} break;
-	case EM_386:	 reltype = R_386_32;                   break;
+	case EM_386:
+		reltype = R_386_32;
+		mcount_adjust_32 = -1;
+		break;
 	case EM_ARM:	 reltype = R_ARM_ABS32;
 			 altmcount = "__gnu_mcount_nc";
 			 break;
@@ -311,7 +314,10 @@
 	case EM_S390:    /* reltype: e_class    */ gpfx = '_'; break;
 	case EM_SH:	 reltype = R_SH_DIR32;                 break;
 	case EM_SPARCV9: reltype = R_SPARC_64;     gpfx = '_'; break;
-	case EM_X86_64:	 reltype = R_X86_64_64;                break;
+	case EM_X86_64:
+		reltype = R_X86_64_64;
+		mcount_adjust_64 = -1;
+		break;
 	}  /* end switch */
 
 	switch (ehdr->e_ident[EI_CLASS]) {
Index: test-2.6/scripts/recordmcount.pl
===================================================================
--- test-2.6.orig/scripts/recordmcount.pl	2011-03-16 09:26:43.006913981 +0100
+++ test-2.6/scripts/recordmcount.pl	2011-05-03 09:39:02.145472579 +0200
@@ -222,6 +222,7 @@
     $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$";
     $type = ".quad";
     $alignment = 8;
+    $mcount_adjust = -1;
 
     # force flags for this arch
     $ld .= " -m elf_x86_64";
@@ -231,6 +232,7 @@
 
 } elsif ($arch eq "i386") {
     $alignment = 4;
+    $mcount_adjust = -1;
 
     # force flags for this arch
     $ld .= " -m elf_i386";

WARNING: multiple messages have this Message-ID (diff)
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-arch@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Russell King <linux@arm.linux.org.uk>,
	Rabin Vincent <rabin@rab.in>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 2/4] x86 mcount offset calculation
Date: Tue, 10 May 2011 10:10:41 +0200	[thread overview]
Message-ID: <20110510081103.363216850@de.ibm.com> (raw)
Message-ID: <20110510081041.Ii60eYJBCtLw8nKuQA_Uqqx26Lkqpq5NQhb3n3dY-5I@z> (raw)
In-Reply-To: 20110510081039.241831019@de.ibm.com

[-- Attachment #1: 301-mcount-adjust-x86.diff --]
[-- Type: text/plain, Size: 2791 bytes --]

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

Do the mcount offset adjustment in the recordmcount.pl/recordmcount.[ch]
at compile time and not in ftrace_call_adjust at run time.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---


 arch/x86/include/asm/ftrace.h |    7 +++----
 scripts/recordmcount.c        |   10 ++++++++--
 scripts/recordmcount.pl       |    2 ++
 3 files changed, 13 insertions(+), 6 deletions(-)
Index: test-2.6/arch/x86/include/asm/ftrace.h
===================================================================
--- test-2.6.orig/arch/x86/include/asm/ftrace.h	2009-09-12 09:47:14.000000000 +0200
+++ test-2.6/arch/x86/include/asm/ftrace.h	2011-05-03 09:39:02.145472579 +0200
@@ -38,11 +38,10 @@
 static inline unsigned long ftrace_call_adjust(unsigned long addr)
 {
 	/*
-	 * call mcount is "e8 <4 byte offset>"
-	 * The addr points to the 4 byte offset and the caller of this
-	 * function wants the pointer to e8. Simply subtract one.
+	 * addr is the address of the mcount call instruction.
+	 * recordmcount does the necessary offset calculation.
 	 */
-	return addr - 1;
+	return addr;
 }
 
 #ifdef CONFIG_DYNAMIC_FTRACE
Index: test-2.6/scripts/recordmcount.c
===================================================================
--- test-2.6.orig/scripts/recordmcount.c	2011-03-16 09:26:43.006913981 +0100
+++ test-2.6/scripts/recordmcount.c	2011-05-03 09:39:02.145472579 +0200
@@ -300,7 +300,10 @@
 			w2(ehdr->e_machine), fname);
 		fail_file();
 	} break;
-	case EM_386:	 reltype = R_386_32;                   break;
+	case EM_386:
+		reltype = R_386_32;
+		mcount_adjust_32 = -1;
+		break;
 	case EM_ARM:	 reltype = R_ARM_ABS32;
 			 altmcount = "__gnu_mcount_nc";
 			 break;
@@ -311,7 +314,10 @@
 	case EM_S390:    /* reltype: e_class    */ gpfx = '_'; break;
 	case EM_SH:	 reltype = R_SH_DIR32;                 break;
 	case EM_SPARCV9: reltype = R_SPARC_64;     gpfx = '_'; break;
-	case EM_X86_64:	 reltype = R_X86_64_64;                break;
+	case EM_X86_64:
+		reltype = R_X86_64_64;
+		mcount_adjust_64 = -1;
+		break;
 	}  /* end switch */
 
 	switch (ehdr->e_ident[EI_CLASS]) {
Index: test-2.6/scripts/recordmcount.pl
===================================================================
--- test-2.6.orig/scripts/recordmcount.pl	2011-03-16 09:26:43.006913981 +0100
+++ test-2.6/scripts/recordmcount.pl	2011-05-03 09:39:02.145472579 +0200
@@ -222,6 +222,7 @@
     $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$";
     $type = ".quad";
     $alignment = 8;
+    $mcount_adjust = -1;
 
     # force flags for this arch
     $ld .= " -m elf_x86_64";
@@ -231,6 +232,7 @@
 
 } elsif ($arch eq "i386") {
     $alignment = 4;
+    $mcount_adjust = -1;
 
     # force flags for this arch
     $ld .= " -m elf_i386";


  parent reply	other threads:[~2011-05-10  8:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10  8:10 [patch 0/4] [RFC] mcount address adjustment Martin Schwidefsky
2011-05-10  8:10 ` Martin Schwidefsky
2011-05-10  8:10 ` [patch 1/4] recordmcount " Martin Schwidefsky
2011-05-10  8:10   ` Martin Schwidefsky
2011-05-10  8:10 ` Martin Schwidefsky [this message]
2011-05-10  8:10   ` [patch 2/4] x86 mcount offset calculation Martin Schwidefsky
2011-05-10  8:10 ` [patch 3/4] ia64 " Martin Schwidefsky
2011-05-10  8:10   ` Martin Schwidefsky
2011-05-16 18:58   ` Steven Rostedt
2011-05-16 19:17     ` Luck, Tony
2011-05-16 19:17       ` Luck, Tony
2011-05-16 20:41       ` Steven Rostedt
2011-05-17  8:04       ` Martin Schwidefsky
2011-05-17 11:20         ` Steven Rostedt
2011-05-10  8:10 ` [patch 4/4] s390 " Martin Schwidefsky
2011-05-10  8:10   ` Martin Schwidefsky
2011-05-11 17:23 ` [patch 0/4] [RFC] mcount address adjustment Rabin Vincent
2011-05-11 17:23   ` Rabin Vincent
2011-05-12  9:24   ` Martin Schwidefsky
2011-05-12  9:24     ` Martin Schwidefsky
2011-05-12 13:30     ` Rabin Vincent
2011-05-12 13:30       ` Rabin Vincent
2011-05-16 12:57       ` Dave Martin
2011-05-16 12:57         ` Dave Martin
2011-05-16 14:28         ` Steven Rostedt
2011-05-16 14:28           ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110510081103.363216850@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.