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 3/6] ftrace: enable mcount recording for modules
Date: Thu, 14 Aug 2008 15:45:09 -0400 [thread overview]
Message-ID: <20080814194859.811269740@goodmis.org> (raw)
In-Reply-To: 20080814194506.233473381@goodmis.org
[-- Attachment #1: ftrace-mcount-loc-modules.patch --]
[-- Type: text/plain, Size: 3102 bytes --]
This patch enables the loading of the __mcount_section of modules and
changing all the callers of mcount into nops.
The modification is done before the init_module function is called, so
again, we do not need to use kstop_machine to make these changes.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
include/linux/ftrace.h | 3 +++
kernel/module.c | 11 +++++++++++
kernel/trace/ftrace.c | 5 +++++
3 files changed, 19 insertions(+)
Index: linux-tip.git/include/linux/ftrace.h
===================================================================
--- linux-tip.git.orig/include/linux/ftrace.h 2008-08-14 13:59:19.000000000 -0400
+++ linux-tip.git/include/linux/ftrace.h 2008-08-14 14:03:44.000000000 -0400
@@ -143,8 +143,11 @@ ftrace_special(unsigned long arg1, unsig
#ifdef CONFIG_FTRACE_MCOUNT_RECORD
extern void ftrace_init(void);
+extern void ftrace_init_module(unsigned long *start, unsigned long *end);
#else
static inline void ftrace_init(void) { }
+static inline void
+ftrace_init_module(unsigned long *start, unsigned long *end) { }
#endif
#endif /* _LINUX_FTRACE_H */
Index: linux-tip.git/kernel/module.c
===================================================================
--- linux-tip.git.orig/kernel/module.c 2008-08-14 13:55:13.000000000 -0400
+++ linux-tip.git/kernel/module.c 2008-08-14 14:03:44.000000000 -0400
@@ -48,6 +48,7 @@
#include <linux/license.h>
#include <asm/sections.h>
#include <linux/tracepoint.h>
+#include <linux/ftrace.h>
#if 0
#define DEBUGP printk
@@ -1835,6 +1836,7 @@ static struct module *load_module(void _
unsigned int markersstringsindex;
unsigned int tracepointsindex;
unsigned int tracepointsstringsindex;
+ unsigned int mcountindex;
struct module *mod;
long err = 0;
void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
@@ -2125,6 +2127,9 @@ static struct module *load_module(void _
tracepointsstringsindex = find_sec(hdr, sechdrs, secstrings,
"__tracepoints_strings");
+ mcountindex = find_sec(hdr, sechdrs, secstrings,
+ "__mcount_loc");
+
/* Now do relocations. */
for (i = 1; i < hdr->e_shnum; i++) {
const char *strtab = (char *)sechdrs[strindex].sh_addr;
@@ -2185,6 +2190,12 @@ static struct module *load_module(void _
mod->tracepoints + mod->num_tracepoints);
#endif
}
+
+ if (mcountindex) {
+ void *mseg = (void *)sechdrs[mcountindex].sh_addr;
+ ftrace_init_module(mseg, mseg + sechdrs[mcountindex].sh_size);
+ }
+
err = module_finalize(hdr, sechdrs, mod);
if (err < 0)
goto cleanup;
Index: linux-tip.git/kernel/trace/ftrace.c
===================================================================
--- linux-tip.git.orig/kernel/trace/ftrace.c 2008-08-14 13:59:19.000000000 -0400
+++ linux-tip.git/kernel/trace/ftrace.c 2008-08-14 14:03:44.000000000 -0400
@@ -1548,6 +1548,11 @@ static int ftrace_convert_nops(unsigned
return 0;
}
+void ftrace_init_module(unsigned long *start, unsigned long *end)
+{
+ ftrace_convert_nops(start, end);
+}
+
extern unsigned long __start_mcount_loc[];
extern unsigned long __stop_mcount_loc[];
--
next prev 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 ` Steven Rostedt [this message]
2008-08-14 23:26 ` [PATCH v2 3/6] ftrace: enable mcount recording for modules 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 ` [PATCH v2 6/6] ftrace: x86 mcount stub Steven Rostedt
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=20080814194859.811269740@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 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.