On Thu, 14 Jul 2022 00:11:53 +0000 Song Liu <songliubraving@xxxxxx> wrote: > > That is, can we register a direct function with this function and pick a > > function with IPMODIFY already attached? > > Yes, if the direct function follows regs->ip, it works. > > For example, BPF trampoline with only fentry calls will just work with only this patch. I replied with my thoughts on this to patch 3, but I disagree with this. ftrace has no idea if the direct trampoline modifies the IP or not. ftrace must assume that it does, and the management should be done in the infrastructure. As I replied to patch 3, here's my thoughts. DIRECT is treated as though it changes the IP. If you register it to a function that has an IPMODIFY already set to it, it will call the ops->ops_func() asking if the ops can use SHARED_IPMODIFY (which means a DIRECT can be shared with IPMODIFY). If it can, then it returns true, and the SHARED_IPMODIFY is set *by ftrace*. The user of the ftrace APIs should not have to manage this. It should be managed by the ftrace infrastructure. Make sense? -- Steve