lkml.org 
[lkml]   [2023]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH v2 4/6] tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS
On Wed, Aug 9, 2023 at 4:45 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > --- a/kernel/trace/trace_fprobe.c
> > > +++ b/kernel/trace/trace_fprobe.c
> > > @@ -132,25 +132,30 @@ static int
> > > process_fetch_insn(struct fetch_insn *code, void *rec, void *dest,
> > > void *base)
> > > {
> > > - struct pt_regs *regs = rec;
> > > - unsigned long val;
> > > + struct ftrace_regs *fregs = rec;
> > > + unsigned long val, *stackp;
> > > int ret;
> > >
> > > retry:
> > > /* 1st stage: get value from context */
> > > switch (code->op) {
> > > case FETCH_OP_STACK:
> > > - val = regs_get_kernel_stack_nth(regs, code->param);
> > > + stackp = (unsigned long *)ftrace_regs_get_stack_pointer(fregs);
> > > + if (((unsigned long)(stackp + code->param) & ~(THREAD_SIZE - 1)) ==
> > > + ((unsigned long)stackp & ~(THREAD_SIZE - 1)))
> >
> > Maybe it'd be worth extracting a local
> > "ftrace_regs_get_kernel_stack_nth_addr" helper function and/or
> > "ftrace_regs_within_kernel_stack" ?
>
> Yeah, maybe we can make it a generic inline function in linux/ftrace.h.

Or even just above this function if there are low chances it would get
used elsewhere :)

\
 
 \ /
  Last update: 2023-08-09 17:39    [W:0.054 / U:0.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site