Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-04-03 Thread Torsten Duwe
On Wed, Apr 03, 2019 at 03:48:43AM +0100, Mark Rutland wrote: > Hi Torsten, > > Sorry for the long delay prior to this reply. I was hoping you would come up with some code to speed things up :( (For the record, v8 was the latest I sent, but nothing in the locations mentioned here has changed)

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-04-03 Thread Steven Rostedt
On Wed, 3 Apr 2019 03:48:43 +0100 Mark Rutland wrote: > We currently have: > > ftrace_make_nop(mod, rec, addr) > ftrace_make_call(rec, addr) > ftrace_modify_call(rec, old_addr, new_addr) > > ... whereas we could have: > > ftrace_call_init(mod, rec) > ftrace_call_enable(rec, addr) >

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-04-02 Thread Mark Rutland
Hi Torsten, Sorry for the long delay prior to this reply. On Fri, Jan 18, 2019 at 05:39:08PM +0100, Torsten Duwe wrote: > Once gcc8 adds 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

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-07 Thread Torsten Duwe
On Thu, Feb 07, 2019 at 09:51:57AM -0500, Steven Rostedt wrote: > On Thu, 7 Feb 2019 10:33:50 + > Julien Thierry wrote: > > > I don't see really much documentation on that function. As far as I can > > tell it is only called once for each site (and if it didn't, we'd always > > be placing

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-07 Thread Julien Thierry
On 07/02/2019 14:51, Steven Rostedt wrote: > On Thu, 7 Feb 2019 10:33:50 + > Julien Thierry wrote: > >> I don't see really much documentation on that function. As far as I can >> tell it is only called once for each site (and if it didn't, we'd always >> be placing the same instruction,

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-07 Thread Steven Rostedt
On Thu, 7 Feb 2019 10:33:50 + Julien Thierry wrote: > I don't see really much documentation on that function. As far as I can > tell it is only called once for each site (and if it didn't, we'd always > be placing the same instruction, but I agree it wouldn't be nice). It > could depend on

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-07 Thread Julien Thierry
On 07/02/2019 12:51, Torsten Duwe wrote: > On Thu, Feb 07, 2019 at 10:33:50AM +, Julien Thierry wrote: >> >> >> On 06/02/2019 15:05, Torsten Duwe wrote: >>> On Wed, Feb 06, 2019 at 08:59:44AM +, Julien Thierry wrote: Hi Torsten, On 18/01/2019 16:39, Torsten Duwe wrote:

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-07 Thread Torsten Duwe
On Thu, Feb 07, 2019 at 10:33:50AM +, Julien Thierry wrote: > > > On 06/02/2019 15:05, Torsten Duwe wrote: > > On Wed, Feb 06, 2019 at 08:59:44AM +, Julien Thierry wrote: > >> Hi Torsten, > >> > >> On 18/01/2019 16:39, Torsten Duwe wrote: > >> > >>> --- a/arch/arm64/kernel/ftrace.c > >>>

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-07 Thread Julien Thierry
On 06/02/2019 15:05, Torsten Duwe wrote: > On Wed, Feb 06, 2019 at 08:59:44AM +, Julien Thierry wrote: >> Hi Torsten, >> >> On 18/01/2019 16:39, Torsten Duwe wrote: >> >>> --- a/arch/arm64/kernel/ftrace.c >>> +++ b/arch/arm64/kernel/ftrace.c >>> @@ -133,17 +163,45 @@ int

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-06 Thread Torsten Duwe
On Wed, Feb 06, 2019 at 08:59:44AM +, Julien Thierry wrote: > Hi Torsten, > > On 18/01/2019 16:39, Torsten Duwe wrote: > > > --- a/arch/arm64/kernel/ftrace.c > > +++ b/arch/arm64/kernel/ftrace.c > > @@ -133,17 +163,45 @@ int ftrace_make_call(struct dyn_ftrace * > > return

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-06 Thread Steven Rostedt
On Wed, 6 Feb 2019 08:59:44 + Julien Thierry wrote: > Hi Torsten, > > On 18/01/2019 16:39, Torsten Duwe wrote: > > Once gcc8 adds 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

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-06 Thread Julien Thierry
On 06/02/2019 08:59, Julien Thierry wrote: > Hi Torsten, > > On 18/01/2019 16:39, Torsten Duwe wrote: >> Once gcc8 adds 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

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-06 Thread Julien Thierry
Hi Torsten, On 18/01/2019 16:39, Torsten Duwe wrote: > Once gcc8 adds 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

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-04 Thread Ard Biesheuvel
On Mon, 4 Feb 2019 at 13:03, Torsten Duwe wrote: > > On Tue, Jan 22, 2019 at 02:55:12PM +0100, Ard Biesheuvel wrote: > > On Tue, 22 Jan 2019 at 14:28, Torsten Duwe wrote: > > > > > > On Tue, Jan 22, 2019 at 10:18:17AM +, Julien Thierry wrote: > > > > Hi Torsten, > > > > > > > > A few

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-02-04 Thread Torsten Duwe
On Tue, Jan 22, 2019 at 02:55:12PM +0100, Ard Biesheuvel wrote: > On Tue, 22 Jan 2019 at 14:28, Torsten Duwe wrote: > > > > On Tue, Jan 22, 2019 at 10:18:17AM +, Julien Thierry wrote: > > > Hi Torsten, > > > > > > A few suggestions below. > > > > > > > +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-01-23 Thread Singh, Balbir
On 1/23/19 2:09 AM, Torsten Duwe wrote: > Hi Balbir! > Hi, Torsten! > On Tue, Jan 22, 2019 at 02:39:32PM +1300, Singh, Balbir wrote: >> >> On 1/19/19 5:39 AM, Torsten Duwe wrote: >>> + */ >>> +ftrace_common_return: >>> + /* restore function args */ >>> + ldp x0, x1, [sp] >>> + ldp

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-01-22 Thread Ard Biesheuvel
On Tue, 22 Jan 2019 at 14:28, Torsten Duwe wrote: > > On Tue, Jan 22, 2019 at 10:18:17AM +, Julien Thierry wrote: > > Hi Torsten, > > > > A few suggestions below. > > > > > +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS > > > +#define ARCH_SUPPORTS_FTRACE_OPS 1 > > > +#define REC_IP_BRANCH_OFFSET

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-01-22 Thread Julien Thierry
On 22/01/2019 13:28, Torsten Duwe wrote: > On Tue, Jan 22, 2019 at 10:18:17AM +, Julien Thierry wrote: >> Hi Torsten, >> >> A few suggestions below. >> >>> +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS >>> +#define ARCH_SUPPORTS_FTRACE_OPS 1 >>> +#define REC_IP_BRANCH_OFFSET AARCH64_INSN_SIZE >>>

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-01-22 Thread Torsten Duwe
On Tue, Jan 22, 2019 at 10:18:17AM +, Julien Thierry wrote: > Hi Torsten, > > A few suggestions below. > > > +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS > > +#define ARCH_SUPPORTS_FTRACE_OPS 1 > > +#define REC_IP_BRANCH_OFFSET AARCH64_INSN_SIZE > > +/* All we need is some magic value. Simply use

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-01-22 Thread Torsten Duwe
Hi Balbir! On Tue, Jan 22, 2019 at 02:39:32PM +1300, Singh, Balbir wrote: > > On 1/19/19 5:39 AM, Torsten Duwe wrote: > > + */ > > +ftrace_common_return: > > + /* restore function args */ > > + ldp x0, x1, [sp] > > + ldp x2, x3, [sp, #S_X2] > > + ldp x4, x5, [sp, #S_X4] > > +

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-01-22 Thread Julien Thierry
Hi Torsten, A few suggestions below. On 18/01/2019 16:39, Torsten Duwe wrote: > Once gcc8 adds 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 >

Re: [PATCH v7 2/3] arm64: implement ftrace with regs

2019-01-21 Thread Singh, Balbir
On 1/19/19 5:39 AM, Torsten Duwe wrote: > Once gcc8 adds 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

[PATCH v7 2/3] arm64: implement ftrace with regs

2019-01-18 Thread Torsten Duwe
Once gcc8 adds 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 frames. Note that