Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback

2020-10-30 Thread Steven Rostedt
On Thu, 29 Oct 2020 10:37:44 -0400 Steven Rostedt wrote: > I also plan on adding code that reports when recursion has happened, > because even if it's not a problem, recursion adds extra overhead. I did the above (will be posting that later, maybe next week), and found two bugs with the

Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback

2020-10-30 Thread Petr Mladek
On Fri 2020-10-30 10:48:58, Miroslav Benes wrote: > > > > > + bit = ftrace_test_recursion_trylock(); > > > > > + if (bit < 0) > > > > > + return; > > > > > > > > This means that the original function will be called in case of > > > > recursion. > > > > That's probably

Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback

2020-10-30 Thread Miroslav Benes
> > > > + bit = ftrace_test_recursion_trylock(); > > > > + if (bit < 0) > > > > + return; > > > > > > This means that the original function will be called in case of > > > recursion. > > > That's probably fair, but I'm wondering if we should at least WARN about > >

Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback

2020-10-29 Thread Steven Rostedt
On Thu, 29 Oct 2020 15:57:09 +0100 Petr Mladek wrote: > On Thu 2020-10-29 14:51:06, Miroslav Benes wrote: > > On Wed, 28 Oct 2020, Steven Rostedt wrote: > > > > > From: "Steven Rostedt (VMware)" > > > > > > If a ftrace callback does not supply its own recursion protection and > > > does not

Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback

2020-10-29 Thread Miroslav Benes
On Thu, 29 Oct 2020, Petr Mladek wrote: > On Thu 2020-10-29 14:51:06, Miroslav Benes wrote: > > On Wed, 28 Oct 2020, Steven Rostedt wrote: > > > Hm, I've always thought that we did not need any kind of recursion > > protection for our callback. It is marked as notrace and it does not call > >

Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback

2020-10-29 Thread Petr Mladek
On Thu 2020-10-29 14:51:06, Miroslav Benes wrote: > On Wed, 28 Oct 2020, Steven Rostedt wrote: > > > From: "Steven Rostedt (VMware)" > > > > If a ftrace callback does not supply its own recursion protection and > > does not set the RECURSION_SAFE flag in its ftrace_ops, then ftrace will > >

Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback

2020-10-29 Thread Steven Rostedt
On Thu, 29 Oct 2020 14:51:06 +0100 (CET) Miroslav Benes wrote: > > index b552cf2d85f8..6c0164d24bbd 100644 > > --- a/kernel/livepatch/patch.c > > +++ b/kernel/livepatch/patch.c > > @@ -45,9 +45,13 @@ static void notrace klp_ftrace_handler(unsigned long ip, > > struct klp_ops *ops; > >

Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback

2020-10-29 Thread Miroslav Benes
On Wed, 28 Oct 2020, Steven Rostedt wrote: > From: "Steven Rostedt (VMware)" > > If a ftrace callback does not supply its own recursion protection and > does not set the RECURSION_SAFE flag in its ftrace_ops, then ftrace will > make a helper trampoline to do so before calling the callback

[PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback

2020-10-28 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" If a ftrace callback does not supply its own recursion protection and does not set the RECURSION_SAFE flag in its ftrace_ops, then ftrace will make a helper trampoline to do so before calling the callback instead of just calling the callback directly. The default