Re: [PATCH] ftrace: mcount record based dynamic tracing for ARM

From: Russell King - ARM Linux
Date: Fri Nov 21 2008 - 10:39:21 EST


On Fri, Nov 21, 2008 at 09:27:17AM -0500, Steven Rostedt wrote:
> On Thu, 20 Nov 2008, Jim Radford wrote:
> > - select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
> > + select HAVE_FTRACE_MCOUNT_RECORD
> > + select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
>
> Russell mentioned something about the code not being compatible with
> Thumb2, is the above if statement enough?

I think I said (or should've said) "upcoming Thumb 2" - it's not yet in
the kernel but there's a patch series floating around for it. We've
started on merging some of the pre-requisits, and it will mean that
the instruction length is no longer constant. (It may be a 16bit or
32bit instruction.)

I suspect that ftrace won't be able to handle that, so it may have to
depend on !THUMB2_KERNEL for the time being.

> > diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
> > index 06269ea..06216af 100644
> > --- a/arch/arm/kernel/entry-common.S
> > +++ b/arch/arm/kernel/entry-common.S
> > @@ -104,14 +104,7 @@ ENDPROC(ret_from_fork)
> > #ifdef CONFIG_FUNCTION_TRACER
> > #ifdef CONFIG_DYNAMIC_FTRACE
> > ENTRY(mcount)
> > - stmdb sp!, {r0-r3, lr}
> > - mov r0, lr
> > - sub r0, r0, #MCOUNT_INSN_SIZE
> > -
> > - .globl mcount_call
> > -mcount_call:
> > - bl ftrace_stub
> > - ldmia sp!, {r0-r3, pc}
> > + mov pc, lr
>
> This looks OK. The new mcount stub for dynamic ftrace is a simple return.
> It has been a while since I've programmed ARM (7 years ago), but I'm
> assuming that loading the program counter with the link register is
> a simple return.

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