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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 May 2009 22:01:34 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	wuzhangjin@...il.com
cc:	linux-mips@...ux-mips.org, linux-kernel@...r.kernel.org,
	Wu Zhangjin <wuzj@...ote.com>,
	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 3/5] mips function graph tracer support


On Fri, 29 May 2009, wuzhangjin@...il.com wrote:
> diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
> index ce8a0ba..bd58f16 100644
> --- a/arch/mips/kernel/mcount.S
> +++ b/arch/mips/kernel/mcount.S
> @@ -28,6 +28,10 @@
>  	PTR_SUBU	sp, PT_SIZE
>  	PTR_S	ra, PT_R31(sp)
>  	PTR_S	$1, PT_R1(sp)
> +#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> +	PTR_S	v0, PT_R2(sp)
> +	PTR_S	v1, PT_R3(sp)
> +#endif
>  	PTR_S	a0, PT_R4(sp)
>  	PTR_S	a1, PT_R5(sp)
>  	PTR_S	a2, PT_R6(sp)
> @@ -43,6 +47,10 @@
>  	.macro MCOUNT_RESTORE_REGS
>  	PTR_L	ra, PT_R31(sp)
>  	PTR_L	$1, PT_R1(sp)
> +#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> +	PTR_L	v0, PT_R2(sp)
> +	PTR_L	v1, PT_R3(sp)
> +#endif
>  	PTR_L	a0, PT_R4(sp)
>  	PTR_L	a1, PT_R5(sp)
>  	PTR_L	a2, PT_R6(sp)
> @@ -89,6 +97,14 @@ ftrace_call:
>  	nop
>  
>  	MCOUNT_RESTORE_REGS
> +
> +#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> +	.globl ftrace_graph_call
> +ftrace_graph_call:
> +	j	ftrace_stub
> +	nop
> +#endif
> +
>  	.globl ftrace_stub
>  ftrace_stub:
>  	RETURN_BACK
> @@ -106,7 +122,15 @@ NESTED(_mcount, PT_SIZE, ra)
>  	PTR_L	t1, ftrace_trace_function /* please don't use t1 later, safe? */
>  	bne	t0, t1, static_trace
>  	nop
> -
> +#ifdef	CONFIG_FUNCTION_GRAPH_TRACER
> +	PTR_L	t2, ftrace_graph_return
> +	bne	t0,	t2, ftrace_graph_caller
> +	nop
> +	PTR_LA	t0, ftrace_graph_entry_stub
> +	PTR_L	t2, ftrace_graph_entry
> +	bne	t0,	t2, ftrace_graph_caller
> +	nop
> +#endif
>  	j	ftrace_stub
>  	nop
>  
> @@ -125,5 +149,37 @@ ftrace_stub:
>  
>  #endif	/* ! CONFIG_DYNAMIC_FTRACE */
>  
> +#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> +
> +NESTED(ftrace_graph_caller, PT_SIZE, ra)
> +	MCOUNT_SAVE_REGS
> +
> +	MCOUNT_SET_ARGS
> +	jal	prepare_ftrace_return
> +	nop
> +
> +	/* overwrite the parent as &return_to_handler: v0 -> $1(at) */
> +	PTR_S	v0, PT_R1(sp)
> +
> +	MCOUNT_RESTORE_REGS
> +	RETURN_BACK
> +	END(ftrace_graph_caller)
> +
> +	.align	2
> +	.globl	return_to_handler
> +return_to_handler:
> +	MCOUNT_SAVE_REGS

I'm not sure which version of function_graph tracer you looked at, but I'm 
pretty sure you can just save the return code registers of the function.

return_to_handler is called on the return of a function. Thus, any callee 
saved registers have already been restored and would also be restored by 
ftrace_return_to_handler.  Any callee registers would have been saved by 
the function you are about to return to.

Thus the only things you need to save are the return code registers.

-- Steve


> +
> +	jal	ftrace_return_to_handler
> +	nop
> +
> +	/* restore the real parent address: v0 -> ra */
> +	PTR_S	v0, PT_R31(sp)
> +
> +	MCOUNT_RESTORE_REGS
> +	RETURN_BACK
> +
> +#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
> +
>  	.set at
>  	.set reorder
> diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
> index 58738c8..67435e5 100644
> --- a/arch/mips/kernel/vmlinux.lds.S
> +++ b/arch/mips/kernel/vmlinux.lds.S
> @@ -36,6 +36,7 @@ SECTIONS
>  		SCHED_TEXT
>  		LOCK_TEXT
>  		KPROBES_TEXT
> +		IRQENTRY_TEXT
>  		*(.text.*)
>  		*(.fixup)
>  		*(.gnu.warning)
> -- 
> 1.6.0.4
> 
> 
--
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