From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
Ralf Baechle <ralf@linux-mips.org>, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Nicholas Mc Guire <der.herr@hofr.at>
Subject: Re: [PATCH v1 1/5] mips static function tracer support
Date: Fri, 29 May 2009 14:11:53 +0800 [thread overview]
Message-ID: <1243577513.12679.0.camel@falcon> (raw)
In-Reply-To: <alpine.DEB.2.00.0905281713260.11238@gandalf.stny.rr.com>
On Thu, 2009-05-28 at 21:13 -0400, Steven Rostedt wrote:
>
> On Fri, 29 May 2009, wuzhangjin@gmail.com wrote:
>
> > From: Wu Zhangjin <wuzj@lemote.com>
> >
> > if -pg of gcc is enabled. a calling to _mcount will be inserted to each
> > kernel function. so, there is a possibility to trace the functions in
> > _mcount.
> >
> > here is the implementation of mips specific _mcount for static function
> > tracer.
> >
> > -ffunction-sections option not works with -pg, so disable it if enables
> > FUNCTION_TRACER.
> >
> > Signed-off-by: Wu Zhangjin <wuzj@lemote.com>
> > ---
> > arch/mips/Kconfig | 2 +
> > arch/mips/Makefile | 2 +
> > arch/mips/include/asm/ftrace.h | 25 ++++++++++-
> > arch/mips/kernel/Makefile | 8 +++
> > arch/mips/kernel/mcount.S | 98 ++++++++++++++++++++++++++++++++++++++++
> > arch/mips/kernel/mips_ksyms.c | 5 ++
> > 6 files changed, 139 insertions(+), 1 deletions(-)
> > create mode 100644 arch/mips/kernel/mcount.S
> >
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index 09b1287..d5c01ca 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -4,6 +4,8 @@ config MIPS
> > select HAVE_IDE
> > select HAVE_OPROFILE
> > select HAVE_ARCH_KGDB
> > + select HAVE_FUNCTION_TRACER
> > + select HAVE_FUNCTION_TRACE_MCOUNT_TEST
> > # Horrible source of confusion. Die, die, die ...
> > select EMBEDDED
> > select RTC_LIB
> > diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> > index c4cae9e..f86fb15 100644
> > --- a/arch/mips/Makefile
> > +++ b/arch/mips/Makefile
> > @@ -48,7 +48,9 @@ ifneq ($(SUBARCH),$(ARCH))
> > endif
> > endif
> >
> > +ifndef CONFIG_FUNCTION_TRACER
> > cflags-y := -ffunction-sections
> > +endif
> > cflags-y += $(call cc-option, -mno-check-zero-division)
> >
> > ifdef CONFIG_32BIT
> > diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h
> > index 40a8c17..5f8ebcf 100644
> > --- a/arch/mips/include/asm/ftrace.h
> > +++ b/arch/mips/include/asm/ftrace.h
> > @@ -1 +1,24 @@
> > -/* empty */
> > +/*
> > + * This file is subject to the terms and conditions of the GNU General Public
> > + * License. See the file "COPYING" in the main directory of this archive for
> > + * more details.
> > + *
> > + * Copyright (C) 2009 DSLab, Lanzhou University, China
> > + * Author: Wu Zhangjin <wuzj@lemote.com>
> > + */
> > +
> > +#ifndef _ASM_MIPS_FTRACE_H
> > +#define _ASM_MIPS_FTRACE_H
> > +
> > +#ifdef CONFIG_FUNCTION_TRACER
> > +
> > +#define MCOUNT_ADDR ((unsigned long)(_mcount))
> > +#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
> > +
> > +#ifndef __ASSEMBLY__
> > +extern void _mcount(void);
> > +#define mcount _mcount
> > +
> > +#endif /* __ASSEMBLY__ */
> > +#endif /* CONFIG_FUNCTION_TRACER */
> > +#endif /* _ASM_MIPS_FTRACE_H */
> > diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
> > index e961221..d167dde 100644
> > --- a/arch/mips/kernel/Makefile
> > +++ b/arch/mips/kernel/Makefile
> > @@ -8,6 +8,12 @@ obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
> > ptrace.o reset.o setup.o signal.o syscall.o \
> > time.o topology.o traps.o unaligned.o watch.o
> >
> > +ifdef CONFIG_FUNCTION_TRACER
> > +# Do not profile debug and lowlevel utilities
> > +CFLAGS_REMOVE_mcount.o = -pg
>
> mcount.S is an assembly file, the above is for C files. So it is not
> needed.
Removed, thanks!
>
> -- Steve
>
> > +CFLAGS_REMOVE_early_printk.o = -pg
> > +endif
> > +
> > obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o
> > obj-$(CONFIG_CEVT_R4K_LIB) += cevt-r4k.o
> > obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o
> > @@ -24,6 +30,8 @@ obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
> > obj-$(CONFIG_STACKTRACE) += stacktrace.o
> > obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
> >
> > +obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
> > +
> > obj-$(CONFIG_CPU_LOONGSON2) += r4k_fpu.o r4k_switch.o
> > obj-$(CONFIG_CPU_MIPS32) += r4k_fpu.o r4k_switch.o
> > obj-$(CONFIG_CPU_MIPS64) += r4k_fpu.o r4k_switch.o
> > diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
> > new file mode 100644
> > index 0000000..268724e
> > --- /dev/null
next prev parent reply other threads:[~2009-05-29 6:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1243543471.git.wuzj@lemote.com>
2009-05-28 20:48 ` [PATCH v1 1/5] mips static function tracer support wuzhangjin
2009-05-29 1:13 ` Steven Rostedt
2009-05-29 6:11 ` Wu Zhangjin [this message]
2009-05-28 20:48 ` [PATCH v1 2/5] mips dynamic " wuzhangjin
2009-05-29 1:24 ` Steven Rostedt
2009-05-29 6:36 ` Wu Zhangjin
2009-05-29 15:07 ` Steven Rostedt
2009-05-28 20:49 ` [PATCH v1 3/5] mips function graph " wuzhangjin
2009-05-29 2:01 ` Steven Rostedt
2009-05-29 9:07 ` Wu Zhangjin
2009-05-29 15:16 ` Steven Rostedt
2009-05-28 20:49 ` [PATCH v1 4/5] mips specific clock function to get precise timestamp wuzhangjin
2009-05-29 2:06 ` Steven Rostedt
2009-05-28 20:49 ` [PATCH v1 5/5] mips specific system call tracer wuzhangjin
2009-05-29 2:09 ` 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=1243577513.12679.0.camel@falcon \
--to=wuzhangjin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=der.herr@hofr.at \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mingo@elte.hu \
--cc=ralf@linux-mips.org \
--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.