lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1243577513.12679.0.camel@falcon>
Date:	Fri, 29 May 2009 14:11:53 +0800
From:	Wu Zhangjin <wuzhangjin@...il.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	linux-mips@...ux-mips.org, linux-kernel@...r.kernel.org,
	Ralf Baechle <ralf@...ux-mips.org>,
	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Nicholas Mc Guire <der.herr@...r.at>
Subject: Re: [PATCH v1 1/5] mips static function tracer support

On Thu, 2009-05-28 at 21:13 -0400, Steven Rostedt wrote:
> 
> On Fri, 29 May 2009, wuzhangjin@...il.com wrote:
> 
> > From: Wu Zhangjin <wuzj@...ote.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@...ote.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@...ote.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ