Re: [PATCH 2/6] riscv/ftrace: Add dynamic function tracer support

2018-01-11 Thread Alan Kao
On Wed, Jan 10, 2018 at 11:36:43AM -0500, Steven Rostedt wrote: > On Wed, 10 Jan 2018 15:38:10 +0800 > Alan Kao wrote: > > > +static int __ftrace_modify_call(unsigned long hook_pos, unsigned long > > target, > > + bool enable) > > +{ > > + unsigned int offset = (unsig

Re: [PATCH 2/6] riscv/ftrace: Add dynamic function tracer support

2018-01-10 Thread Steven Rostedt
On Wed, 10 Jan 2018 15:38:10 +0800 Alan Kao wrote: > +static int __ftrace_modify_call(unsigned long hook_pos, unsigned long target, > + bool enable) > +{ > + unsigned int offset = (unsigned int)(target - hook_pos); > + unsigned int auipc_call = to_auipc_insn(of

Re: [PATCH 2/6] riscv/ftrace: Add dynamic function tracer support

2018-01-10 Thread Steven Rostedt
On Wed, 10 Jan 2018 15:38:10 +0800 Alan Kao wrote: > +static int ftrace_check_current_call(unsigned long hook_pos, > + unsigned int *expected) > +{ > + unsigned int replaced[2]; > + unsigned int nops[2] = {NOP4, NOP4}; > + > + /* we expect nops at the

[PATCH 2/6] riscv/ftrace: Add dynamic function tracer support

2018-01-09 Thread Alan Kao
We now have dynamic ftrace with the following added items: * ftrace_make_call, ftrace_make_nop (in kernel/ftrace.c) The two functions turns any recorded call site of filtered functions into a call to ftrace_caller or nops * ftracce_update_ftrace_func (in kernel/ftrace.c) turns the nops at f