Re: [PATCH 03/10] ftrace: Add register_ftrace_direct()

From: Steven Rostedt
Date: Thu Nov 14 2019 - 13:48:34 EST


On Thu, 14 Nov 2019 10:34:09 -0800
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote:

> > Alexei,
> >
> > Do you still need such a feature?
> >
> > Note, I just pushed my tree to my for-next tree, and also have a
> > ftrace/direct branch that ends with this patch set that is the basis of
> > the rest of the work of my code. Feel free to build against that
> > branch if you need to have something built on the net tree.
>
> I'm still trying to figure out what you meant
> by your suggestion to implement a modify_ftrace_direct().
> I was thinking something much simpler like
> modify_ftrace_direct(ip, old_call, new_ca);
> will just text poke that call addr from old to new if old matches

The main reason, is that then we need to add another arch specific
change, where as, the solution I suggested doesn't need anything new.
The less arch specific code we need the better.

> and will adjust ftrace inner bookkeeping.
> I don't understand why you want to malloc/free ftrace_ops for that.

We wouldn't need to allocate it, the stub could be something as simple
as:

struct ftrace_ops dummy_ops = {
.func = ftrace_stub;
}

And just register that, where we set the hash to it, which would
require an malloc and free, but is that really a problem? A modify
shouldn't be a hot path, as text poke itself is going to be slow.

-- Steve