On Tue, 22 Oct 2019 14:58:43 -0700 Alexei Starovoitov <alexei.starovoi...@gmail.com> wrote:
> On Tue, Oct 22, 2019 at 05:04:30PM -0400, Steven Rostedt wrote: > > > > I gave a solution for this. And that is to add another flag to allow > > for just the minimum to change the ip. And we can even add another flag > > to allow for changing the stack if needed (to emulate a call with the > > same parameters). > > your solution is to reduce the overhead. > my solution is to remove it competely. See the difference? You're just trimming it down. I'm curious to what overhead you save by not saving all parameter registers, and doing a case by case basis? > > > By doing this work, live kernel patching will also benefit. Because it > > is also dealing with the unnecessary overhead of saving regs. > > > > And we could possibly even have kprobes benefit from this if a kprobe > > doesn't need full regs. > > Neither of two statements are true. The per-function generated trampoline > I'm talking about is bpf specific. For a function with two arguments it's > just: > push rbp > mov rbp, rsp > push rdi > push rsi > lea rdi,[rbp-0x10] > call jited_bpf_prog What exactly does the jited_bpf_prog do? Does it modify context? or is it for monitoring only. Do only GPL BPF programs get this access? > pop rsi > pop rdi > leave > ret > > fentry's nop is replaced with call to the above. > That's it. > kprobe and live patching has no use out of it. > > > But you said that you can't have this and trace the functions at the > > same time. Which also means you can't do live kernel patching on these > > functions either. > > I don't think it's a real use case, but to avoid further arguing > I'll add one nop to the front of generated bpf trampoline so that > ftrace and livepatch can use it. And how does this nop get accounted for? It needs to update the ftrace dyn_ftrace array that stores all the function locations. -- Steve