Re: [PATCH v4 1/3] arm64: implement ftrace with regs

2018-11-12 Thread Torsten Duwe
On Thu, Nov 08, 2018 at 01:12:42PM +0100, Ard Biesheuvel wrote: > > On 26 October 2018 at 16:21, Torsten Duwe wrote: > > @@ -162,6 +165,114 @@ ftrace_graph_call:// > > ftrace_graph_cal > > > > mcount_exit > > ENDPROC(ftrace_caller) > > +#else /* CONFIG_DYNAMIC_FT

Re: [PATCH v4 1/3] arm64: implement ftrace with regs

2018-11-08 Thread Ard Biesheuvel
Hi Torsten, On 26 October 2018 at 16:21, Torsten Duwe wrote: > Use -fpatchable-function-entry (gcc8) to add 2 NOPs at the beginning > of each function. Replace the first NOP thus generated with a quick LR > saver (move it to scratch reg x9), so the 2nd replacement insn, the call > to ftrace, does

Re: [PATCH v4 1/3] arm64: implement ftrace with regs

2018-10-31 Thread Torsten Duwe
On Wed, 31 Oct 2018 14:18:19 + Mark Rutland wrote: > On Wed, Oct 31, 2018 at 02:19:07PM +0100, Jiri Kosina wrote: > > Other architectures do rely on that. That's exactly for example why > > on x86 we use '-pg -mfentry', to make sure we hook the function > > *before* prologue. > > Ah, I'd

Re: [PATCH v4 1/3] arm64: implement ftrace with regs

2018-10-31 Thread Mark Rutland
On Wed, Oct 31, 2018 at 02:19:07PM +0100, Jiri Kosina wrote: > On Wed, 31 Oct 2018, Mark Rutland wrote: > > > I guess skipping the original function prologue would simplify the > > implementation of the replacement function (and would mean that the regs > > held the function arguments per the proc

Re: [PATCH v4 1/3] arm64: implement ftrace with regs

2018-10-31 Thread Jiri Kosina
On Wed, 31 Oct 2018, Mark Rutland wrote: > I guess skipping the original function prologue would simplify the > implementation of the replacement function (and would mean that the regs > held the function arguments per the procedure call standard), but AFAICT > other architectures aren't relying o

Re: [PATCH v4 1/3] arm64: implement ftrace with regs

2018-10-31 Thread Mark Rutland
Hi Torsten, On Fri, Oct 26, 2018 at 04:21:48PM +0200, Torsten Duwe wrote: > Use -fpatchable-function-entry (gcc8) to add 2 NOPs at the beginning > of each function. Replace the first NOP thus generated with a quick LR > saver (move it to scratch reg x9), so the 2nd replacement insn, the call > to

[PATCH v4 1/3] arm64: implement ftrace with regs

2018-10-26 Thread Torsten Duwe
Use -fpatchable-function-entry (gcc8) to add 2 NOPs at the beginning of each function. Replace the first NOP thus generated with a quick LR saver (move it to scratch reg x9), so the 2nd replacement insn, the call to ftrace, does not clobber the value. Ftrace will then generate the standard stack fr