diff mbox series

[2/2] arm64: ftrace: Set FTRACE_SCHEDULABLE before ftrace_modify_all_code()

Message ID 20181205183304.000714627@goodmis.org (mailing list archive)
State New, archived
Headers show
Series tracing: arm64: Make ftrace_replace_code() schedulable for arm64 | expand

Commit Message

Steven Rostedt Dec. 5, 2018, 5:48 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

It has been reported that ftrace_replace_code() which is called by
ftrace_modify_all_code() can cause a soft lockup warning for an
allmodconfig kernel. This is because all the debug options enabled
causes the loop in ftrace_replace_code() (which loops over all the
functions being enabled where there can be 10s of thousands), is too
slow, and never schedules out.

To solve this, setting FTRACE_SCHEDULABLE to the command passed into
ftrace_replace_code() will make it call cond_resched() in the loop,
which prevents the soft lockup warning from triggering.

Link: http://lkml.kernel.org/r/20181204192903.8193-1-anders.roxell@linaro.org

Reported-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 arch/arm64/kernel/ftrace.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Will Deacon Dec. 6, 2018, 1:20 p.m. UTC | #1
On Wed, Dec 05, 2018 at 12:48:54PM -0500, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> It has been reported that ftrace_replace_code() which is called by
> ftrace_modify_all_code() can cause a soft lockup warning for an
> allmodconfig kernel. This is because all the debug options enabled
> causes the loop in ftrace_replace_code() (which loops over all the
> functions being enabled where there can be 10s of thousands), is too
> slow, and never schedules out.
> 
> To solve this, setting FTRACE_SCHEDULABLE to the command passed into
> ftrace_replace_code() will make it call cond_resched() in the loop,
> which prevents the soft lockup warning from triggering.
> 
> Link: http://lkml.kernel.org/r/20181204192903.8193-1-anders.roxell@linaro.org
> 
> Reported-by: Anders Roxell <anders.roxell@linaro.org>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
>  arch/arm64/kernel/ftrace.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> index 57e962290df3..9a8de0a79f97 100644
> --- a/arch/arm64/kernel/ftrace.c
> +++ b/arch/arm64/kernel/ftrace.c
> @@ -193,6 +193,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
>  
>  void arch_ftrace_update_code(int command)
>  {
> +	command |= FTRACE_SCHEDULABLE;
>  	ftrace_modify_all_code(command);
>  }

Bikeshed: I'd probably go for FTRACE_MAY_SLEEP, but I'm not going to die
on that hill so...

Acked-by: Will Deacon <will.deacon@arm.com>

Thanks, Steve!

Will
Anders Roxell Dec. 6, 2018, 2:31 p.m. UTC | #2
On Thu, 6 Dec 2018 at 14:19, Will Deacon <will.deacon@arm.com> wrote:
>
> On Wed, Dec 05, 2018 at 12:48:54PM -0500, Steven Rostedt wrote:
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> >
> > It has been reported that ftrace_replace_code() which is called by
> > ftrace_modify_all_code() can cause a soft lockup warning for an
> > allmodconfig kernel. This is because all the debug options enabled
> > causes the loop in ftrace_replace_code() (which loops over all the
> > functions being enabled where there can be 10s of thousands), is too
> > slow, and never schedules out.
> >
> > To solve this, setting FTRACE_SCHEDULABLE to the command passed into
> > ftrace_replace_code() will make it call cond_resched() in the loop,
> > which prevents the soft lockup warning from triggering.
> >
> > Link: http://lkml.kernel.org/r/20181204192903.8193-1-anders.roxell@linaro.org
> >
> > Reported-by: Anders Roxell <anders.roxell@linaro.org>
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > ---
> >  arch/arm64/kernel/ftrace.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> > index 57e962290df3..9a8de0a79f97 100644
> > --- a/arch/arm64/kernel/ftrace.c
> > +++ b/arch/arm64/kernel/ftrace.c
> > @@ -193,6 +193,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
> >
> >  void arch_ftrace_update_code(int command)
> >  {
> > +     command |= FTRACE_SCHEDULABLE;
> >       ftrace_modify_all_code(command);
> >  }
>
> Bikeshed: I'd probably go for FTRACE_MAY_SLEEP, but I'm not going to die
> on that hill so...
>
> Acked-by: Will Deacon <will.deacon@arm.com>

Tested-by: Anders Roxell <anders.roxell@linaro.org>

Cheers,
Anders

>
> Thanks, Steve!
>
> Will
Steven Rostedt Dec. 6, 2018, 3:59 p.m. UTC | #3
On Thu, 6 Dec 2018 13:20:07 +0000
Will Deacon <will.deacon@arm.com> wrote:

> On Wed, Dec 05, 2018 at 12:48:54PM -0500, Steven Rostedt wrote:
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> > 
> > It has been reported that ftrace_replace_code() which is called by
> > ftrace_modify_all_code() can cause a soft lockup warning for an
> > allmodconfig kernel. This is because all the debug options enabled
> > causes the loop in ftrace_replace_code() (which loops over all the
> > functions being enabled where there can be 10s of thousands), is too
> > slow, and never schedules out.
> > 
> > To solve this, setting FTRACE_SCHEDULABLE to the command passed into
> > ftrace_replace_code() will make it call cond_resched() in the loop,
> > which prevents the soft lockup warning from triggering.
> > 
> > Link: http://lkml.kernel.org/r/20181204192903.8193-1-anders.roxell@linaro.org
> > 
> > Reported-by: Anders Roxell <anders.roxell@linaro.org>
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > ---
> >  arch/arm64/kernel/ftrace.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> > index 57e962290df3..9a8de0a79f97 100644
> > --- a/arch/arm64/kernel/ftrace.c
> > +++ b/arch/arm64/kernel/ftrace.c
> > @@ -193,6 +193,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
> >  
> >  void arch_ftrace_update_code(int command)
> >  {
> > +	command |= FTRACE_SCHEDULABLE;
> >  	ftrace_modify_all_code(command);
> >  }  
> 
> Bikeshed: I'd probably go for FTRACE_MAY_SLEEP, but I'm not going to die
> on that hill so...

I like bike sheds. Hmm, it's not too late to change this. Perhaps I
will.

> 
> Acked-by: Will Deacon <will.deacon@arm.com>

Thanks!

If I decide to change the name to MAY_SLEEP, I assume I can still keep
your Acked-by.

-- Steve
Will Deacon Dec. 6, 2018, 4:06 p.m. UTC | #4
On Thu, Dec 06, 2018 at 10:59:14AM -0500, Steven Rostedt wrote:
> On Thu, 6 Dec 2018 13:20:07 +0000
> Will Deacon <will.deacon@arm.com> wrote:
> 
> > On Wed, Dec 05, 2018 at 12:48:54PM -0500, Steven Rostedt wrote:
> > > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> > > 
> > > It has been reported that ftrace_replace_code() which is called by
> > > ftrace_modify_all_code() can cause a soft lockup warning for an
> > > allmodconfig kernel. This is because all the debug options enabled
> > > causes the loop in ftrace_replace_code() (which loops over all the
> > > functions being enabled where there can be 10s of thousands), is too
> > > slow, and never schedules out.
> > > 
> > > To solve this, setting FTRACE_SCHEDULABLE to the command passed into
> > > ftrace_replace_code() will make it call cond_resched() in the loop,
> > > which prevents the soft lockup warning from triggering.
> > > 
> > > Link: http://lkml.kernel.org/r/20181204192903.8193-1-anders.roxell@linaro.org
> > > 
> > > Reported-by: Anders Roxell <anders.roxell@linaro.org>
> > > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > > ---
> > >  arch/arm64/kernel/ftrace.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> > > index 57e962290df3..9a8de0a79f97 100644
> > > --- a/arch/arm64/kernel/ftrace.c
> > > +++ b/arch/arm64/kernel/ftrace.c
> > > @@ -193,6 +193,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
> > >  
> > >  void arch_ftrace_update_code(int command)
> > >  {
> > > +	command |= FTRACE_SCHEDULABLE;
> > >  	ftrace_modify_all_code(command);
> > >  }  
> > 
> > Bikeshed: I'd probably go for FTRACE_MAY_SLEEP, but I'm not going to die
> > on that hill so...
> 
> I like bike sheds. Hmm, it's not too late to change this. Perhaps I
> will.
> 
> > 
> > Acked-by: Will Deacon <will.deacon@arm.com>
> 
> Thanks!
> 
> If I decide to change the name to MAY_SLEEP, I assume I can still keep
> your Acked-by.

Of course!

Will
diff mbox series

Patch

diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index 57e962290df3..9a8de0a79f97 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -193,6 +193,7 @@  int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
 
 void arch_ftrace_update_code(int command)
 {
+	command |= FTRACE_SCHEDULABLE;
 	ftrace_modify_all_code(command);
 }