mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	David Miller <davem@davemloft.net>,
	Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	Roland McGrath <roland@redhat.com>,
	Ulrich Drepper <drepper@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	Gregory Haskins <ghaskins@novell.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	"Luis Claudio R. Goncalves" <lclaudio@uudg.org>,
	Clark Williams <williams@redhat.com>,
	Bruce Duncan <bwduncan@gmail.com>,
	Marcin Slusarz <marcin.slusarz@gmail.com>,
	Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH v2 6/6] ftrace: x86 mcount stub
Date: Thu, 14 Aug 2008 15:45:12 -0400	[thread overview]
Message-ID: <20080814194900.367467310@goodmis.org> (raw)
In-Reply-To: <20080814194506.233473381@goodmis.org>

[-- Attachment #1: ftrace-x86-mcount-stub.patch --]
[-- Type: text/plain, Size: 2880 bytes --]

x86 now sets up the mcount locations through the build and no longer
needs to record the ip when the function is executed. This patch changes
the initial mcount to simply return. There's no need to do any other work.
If the ftrace start up test fails, the original mcount will be what everything
will use, so having this as fast as possible is a good thing.


Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 arch/x86/kernel/entry_32.S |   14 --------------
 arch/x86/kernel/entry_64.S |   26 --------------------------
 arch/x86/kernel/ftrace.c   |   14 ++------------
 3 files changed, 2 insertions(+), 52 deletions(-)

Index: linux-tip.git/arch/x86/kernel/entry_32.S
===================================================================
--- linux-tip.git.orig/arch/x86/kernel/entry_32.S	2008-08-14 13:55:03.000000000 -0400
+++ linux-tip.git/arch/x86/kernel/entry_32.S	2008-08-14 14:06:00.000000000 -0400
@@ -1189,20 +1189,6 @@ ENDPROC(xen_failsafe_callback)
 #ifdef CONFIG_DYNAMIC_FTRACE
 
 ENTRY(mcount)
-	pushl %eax
-	pushl %ecx
-	pushl %edx
-	movl 0xc(%esp), %eax
-	subl $MCOUNT_INSN_SIZE, %eax
-
-.globl mcount_call
-mcount_call:
-	call ftrace_stub
-
-	popl %edx
-	popl %ecx
-	popl %eax
-
 	ret
 END(mcount)
 
Index: linux-tip.git/arch/x86/kernel/entry_64.S
===================================================================
--- linux-tip.git.orig/arch/x86/kernel/entry_64.S	2008-08-14 13:55:03.000000000 -0400
+++ linux-tip.git/arch/x86/kernel/entry_64.S	2008-08-14 14:06:10.000000000 -0400
@@ -64,32 +64,6 @@
 #ifdef CONFIG_FTRACE
 #ifdef CONFIG_DYNAMIC_FTRACE
 ENTRY(mcount)
-
-	subq $0x38, %rsp
-	movq %rax, (%rsp)
-	movq %rcx, 8(%rsp)
-	movq %rdx, 16(%rsp)
-	movq %rsi, 24(%rsp)
-	movq %rdi, 32(%rsp)
-	movq %r8, 40(%rsp)
-	movq %r9, 48(%rsp)
-
-	movq 0x38(%rsp), %rdi
-	subq $MCOUNT_INSN_SIZE, %rdi
-
-.globl mcount_call
-mcount_call:
-	call ftrace_stub
-
-	movq 48(%rsp), %r9
-	movq 40(%rsp), %r8
-	movq 32(%rsp), %rdi
-	movq 24(%rsp), %rsi
-	movq 16(%rsp), %rdx
-	movq 8(%rsp), %rcx
-	movq (%rsp), %rax
-	addq $0x38, %rsp
-
 	retq
 END(mcount)
 
Index: linux-tip.git/arch/x86/kernel/ftrace.c
===================================================================
--- linux-tip.git.orig/arch/x86/kernel/ftrace.c	2008-08-14 13:55:03.000000000 -0400
+++ linux-tip.git/arch/x86/kernel/ftrace.c	2008-08-14 14:18:21.000000000 -0400
@@ -112,18 +112,8 @@ notrace int ftrace_update_ftrace_func(ft
 
 notrace int ftrace_mcount_set(unsigned long *data)
 {
-	unsigned long ip = (long)(&mcount_call);
-	unsigned long *addr = data;
-	unsigned char old[MCOUNT_INSN_SIZE], *new;
-
-	/*
-	 * Replace the mcount stub with a pointer to the
-	 * ip recorder function.
-	 */
-	memcpy(old, &mcount_call, MCOUNT_INSN_SIZE);
-	new = ftrace_call_replace(ip, *addr);
-	*addr = ftrace_modify_code(ip, old, new);
-
+	/* mcount is initialized as a nop */
+	*data = 0;
 	return 0;
 }
 

-- 

  parent reply	other threads:[~2008-08-14 19:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-14 19:45 [PATCH v2 0/6] ftrace: to kill a daemon (small updates) Steven Rostedt
2008-08-14 19:45 ` [PATCH v2 1/6] ftrace: create __mcount_loc section Steven Rostedt
2008-08-14 19:45 ` [PATCH v2 2/6] ftrace: mcount call site on boot nops core Steven Rostedt
2008-08-14 19:45 ` [PATCH v2 3/6] ftrace: enable mcount recording for modules Steven Rostedt
2008-08-14 23:26   ` Rusty Russell
2008-08-14 23:40     ` Steven Rostedt
2008-08-14 19:45 ` [PATCH v2 4/6] ftrace: rebuild everything on change to FTRACE_MCOUNT_RECORD Steven Rostedt
2008-08-14 19:45 ` [PATCH v2 5/6] ftrace: enable using mcount recording on x86 Steven Rostedt
2008-08-14 19:45 ` Steven Rostedt [this message]
2008-08-15  9:24 ` [PATCH v2 0/6] ftrace: to kill a daemon (small updates) Ingo Molnar
2008-08-15 11:22   ` Gregory Haskins
2008-08-15 12:36 ` Marcin Slusarz
2008-08-15 12:50   ` Steven Rostedt
2008-08-15 13:35     ` Marcin Slusarz
2008-08-20 19:28       ` Marcin Slusarz
2008-08-20 19:36         ` Steven Rostedt
2008-08-21 12:08           ` Ingo Molnar

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=20080814194900.367467310@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bwduncan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=drepper@redhat.com \
    --cc=ghaskins@novell.com \
    --cc=jeremy@goop.org \
    --cc=lclaudio@uudg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.slusarz@gmail.com \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=roland@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=srostedt@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=williams@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome