All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "arm64: kernel: pause/unpause function graph tracer in cpu_suspend()" has been added to the 4.1-stable tree
@ 2016-01-27  6:54 gregkh
  2016-03-15 14:08 ` Lorenzo Pieralisi
  0 siblings, 1 reply; 6+ messages in thread
From: gregkh @ 2016-01-27  6:54 UTC (permalink / raw)
  To: lorenzo.pieralisi, catalin.marinas, gregkh, rostedt,
	takahiro.akashi, will.deacon
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    arm64: kernel: pause/unpause function graph tracer in cpu_suspend()

to the 4.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-kernel-pause-unpause-function-graph-tracer-in-cpu_suspend.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From de818bd4522c40ea02a81b387d2fa86f989c9623 Mon Sep 17 00:00:00 2001
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Date: Tue, 17 Nov 2015 11:50:51 +0000
Subject: arm64: kernel: pause/unpause function graph tracer in cpu_suspend()

From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

commit de818bd4522c40ea02a81b387d2fa86f989c9623 upstream.

The function graph tracer adds instrumentation that is required to trace
both entry and exit of a function. In particular the function graph
tracer updates the "return address" of a function in order to insert
a trace callback on function exit.

Kernel power management functions like cpu_suspend() are called
upon power down entry with functions called "finishers" that are in turn
called to trigger the power down sequence but they may not return to the
kernel through the normal return path.

When the core resumes from low-power it returns to the cpu_suspend()
function through the cpu_resume path, which leaves the trace stack frame
set-up by the function tracer in an incosistent state upon return to the
kernel when tracing is enabled.

This patch fixes the issue by pausing/resuming the function graph
tracer on the thread executing cpu_suspend() (ie the function call that
subsequently triggers the "suspend finishers"), so that the function graph
tracer state is kept consistent across functions that enter power down
states and never return by effectively disabling graph tracer while they
are executing.

Fixes: 819e50e25d0c ("arm64: Add ftrace support")
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reported-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/suspend.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -1,3 +1,4 @@
+#include <linux/ftrace.h>
 #include <linux/percpu.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
@@ -71,6 +72,13 @@ int cpu_suspend(unsigned long arg, int (
 	local_dbg_save(flags);
 
 	/*
+	 * Function graph tracer state gets incosistent when the kernel
+	 * calls functions that never return (aka suspend finishers) hence
+	 * disable graph tracing during their execution.
+	 */
+	pause_graph_tracing();
+
+	/*
 	 * mm context saved on the stack, it will be restored when
 	 * the cpu comes out of reset through the identity mapped
 	 * page tables, so that the thread address space is properly
@@ -111,6 +119,8 @@ int cpu_suspend(unsigned long arg, int (
 			hw_breakpoint_restore(NULL);
 	}
 
+	unpause_graph_tracing();
+
 	/*
 	 * Restore pstate flags. OS lock and mdscr have been already
 	 * restored, so from this point onwards, debugging is fully


Patches currently in stable-queue which might be from lorenzo.pieralisi@arm.com are

queue-4.1/arm64-kernel-pause-unpause-function-graph-tracer-in-cpu_suspend.patch

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch "arm64: kernel: pause/unpause function graph tracer in cpu_suspend()" has been added to the 4.1-stable tree
  2016-03-15 14:08 ` Lorenzo Pieralisi
@ 2016-03-15 14:07   ` Steven Rostedt
  2016-03-15 14:39     ` Lorenzo Pieralisi
  2016-03-15 15:04   ` Greg KH
  1 sibling, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2016-03-15 14:07 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: gregkh, catalin.marinas, takahiro.akashi, will.deacon, stable,
	stable-commits, sudeep.holla

On Tue, 15 Mar 2016 14:08:19 +0000
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:

> Hi Greg,
> 
> On Tue, Jan 26, 2016 at 10:54:50PM -0800, gregkh@linuxfoundation.org wrote:
> > 
> > This is a note to let you know that I've just added the patch titled
> > 
> >     arm64: kernel: pause/unpause function graph tracer in cpu_suspend()
> > 
> > to the 4.1-stable tree which can be found at:
> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > 
> > The filename of the patch is:
> >      arm64-kernel-pause-unpause-function-graph-tracer-in-cpu_suspend.patch
> > and it can be found in the queue-4.1 subdirectory.
> > 
> > If you, or anyone else, feels it should not be added to the stable tree,
> > please let <stable@vger.kernel.org> know about it.  
> 
> We have just noticed this patch did not make it to 3.18 stable kernel
> even though it was marked for #3.16+, probably it has slipped through
> the cracks, please let us know what we can do to get it applied
> to the 3.18 stable tree.
> 

Does it apply without conflicts or break the build?

-- Steve

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch "arm64: kernel: pause/unpause function graph tracer in cpu_suspend()" has been added to the 4.1-stable tree
  2016-01-27  6:54 Patch "arm64: kernel: pause/unpause function graph tracer in cpu_suspend()" has been added to the 4.1-stable tree gregkh
@ 2016-03-15 14:08 ` Lorenzo Pieralisi
  2016-03-15 14:07   ` Steven Rostedt
  2016-03-15 15:04   ` Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: Lorenzo Pieralisi @ 2016-03-15 14:08 UTC (permalink / raw)
  To: gregkh
  Cc: catalin.marinas, rostedt, takahiro.akashi, will.deacon, stable,
	stable-commits, sudeep.holla

Hi Greg,

On Tue, Jan 26, 2016 at 10:54:50PM -0800, gregkh@linuxfoundation.org wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     arm64: kernel: pause/unpause function graph tracer in cpu_suspend()
> 
> to the 4.1-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> The filename of the patch is:
>      arm64-kernel-pause-unpause-function-graph-tracer-in-cpu_suspend.patch
> and it can be found in the queue-4.1 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.

We have just noticed this patch did not make it to 3.18 stable kernel
even though it was marked for #3.16+, probably it has slipped through
the cracks, please let us know what we can do to get it applied
to the 3.18 stable tree.

Thanks !
Lorenzo

> 
> 
> From de818bd4522c40ea02a81b387d2fa86f989c9623 Mon Sep 17 00:00:00 2001
> From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Date: Tue, 17 Nov 2015 11:50:51 +0000
> Subject: arm64: kernel: pause/unpause function graph tracer in cpu_suspend()
> 
> From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> 
> commit de818bd4522c40ea02a81b387d2fa86f989c9623 upstream.
> 
> The function graph tracer adds instrumentation that is required to trace
> both entry and exit of a function. In particular the function graph
> tracer updates the "return address" of a function in order to insert
> a trace callback on function exit.
> 
> Kernel power management functions like cpu_suspend() are called
> upon power down entry with functions called "finishers" that are in turn
> called to trigger the power down sequence but they may not return to the
> kernel through the normal return path.
> 
> When the core resumes from low-power it returns to the cpu_suspend()
> function through the cpu_resume path, which leaves the trace stack frame
> set-up by the function tracer in an incosistent state upon return to the
> kernel when tracing is enabled.
> 
> This patch fixes the issue by pausing/resuming the function graph
> tracer on the thread executing cpu_suspend() (ie the function call that
> subsequently triggers the "suspend finishers"), so that the function graph
> tracer state is kept consistent across functions that enter power down
> states and never return by effectively disabling graph tracer while they
> are executing.
> 
> Fixes: 819e50e25d0c ("arm64: Add ftrace support")
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Reported-by: Catalin Marinas <catalin.marinas@arm.com>
> Reported-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Suggested-by: Steven Rostedt <rostedt@goodmis.org>
> Acked-by: Steven Rostedt <rostedt@goodmis.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> ---
>  arch/arm64/kernel/suspend.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> --- a/arch/arm64/kernel/suspend.c
> +++ b/arch/arm64/kernel/suspend.c
> @@ -1,3 +1,4 @@
> +#include <linux/ftrace.h>
>  #include <linux/percpu.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
> @@ -71,6 +72,13 @@ int cpu_suspend(unsigned long arg, int (
>  	local_dbg_save(flags);
>  
>  	/*
> +	 * Function graph tracer state gets incosistent when the kernel
> +	 * calls functions that never return (aka suspend finishers) hence
> +	 * disable graph tracing during their execution.
> +	 */
> +	pause_graph_tracing();
> +
> +	/*
>  	 * mm context saved on the stack, it will be restored when
>  	 * the cpu comes out of reset through the identity mapped
>  	 * page tables, so that the thread address space is properly
> @@ -111,6 +119,8 @@ int cpu_suspend(unsigned long arg, int (
>  			hw_breakpoint_restore(NULL);
>  	}
>  
> +	unpause_graph_tracing();
> +
>  	/*
>  	 * Restore pstate flags. OS lock and mdscr have been already
>  	 * restored, so from this point onwards, debugging is fully
> 
> 
> Patches currently in stable-queue which might be from lorenzo.pieralisi@arm.com are
> 
> queue-4.1/arm64-kernel-pause-unpause-function-graph-tracer-in-cpu_suspend.patch
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch "arm64: kernel: pause/unpause function graph tracer in cpu_suspend()" has been added to the 4.1-stable tree
  2016-03-15 14:07   ` Steven Rostedt
@ 2016-03-15 14:39     ` Lorenzo Pieralisi
  0 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Pieralisi @ 2016-03-15 14:39 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: gregkh, catalin.marinas, takahiro.akashi, will.deacon, stable,
	stable-commits, sudeep.holla

On Tue, Mar 15, 2016 at 10:07:53AM -0400, Steven Rostedt wrote:
> On Tue, 15 Mar 2016 14:08:19 +0000
> Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
> 
> > Hi Greg,
> > 
> > On Tue, Jan 26, 2016 at 10:54:50PM -0800, gregkh@linuxfoundation.org wrote:
> > > 
> > > This is a note to let you know that I've just added the patch titled
> > > 
> > >     arm64: kernel: pause/unpause function graph tracer in cpu_suspend()
> > > 
> > > to the 4.1-stable tree which can be found at:
> > >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > > 
> > > The filename of the patch is:
> > >      arm64-kernel-pause-unpause-function-graph-tracer-in-cpu_suspend.patch
> > > and it can be found in the queue-4.1 subdirectory.
> > > 
> > > If you, or anyone else, feels it should not be added to the stable tree,
> > > please let <stable@vger.kernel.org> know about it.  
> > 
> > We have just noticed this patch did not make it to 3.18 stable kernel
> > even though it was marked for #3.16+, probably it has slipped through
> > the cracks, please let us know what we can do to get it applied
> > to the 3.18 stable tree.
> > 
> 
> Does it apply without conflicts or break the build?

I checked when I marked it for stable 3.16+ but to make sure everything
is fine I have just rechecked against 3.18.28, it applies cleanly and does
not break the build so I hope it can be considered for inclusion.

Thanks,
Lorenzo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch "arm64: kernel: pause/unpause function graph tracer in cpu_suspend()" has been added to the 4.1-stable tree
  2016-03-15 14:08 ` Lorenzo Pieralisi
  2016-03-15 14:07   ` Steven Rostedt
@ 2016-03-15 15:04   ` Greg KH
  2016-03-15 16:28     ` Lorenzo Pieralisi
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2016-03-15 15:04 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: catalin.marinas, rostedt, takahiro.akashi, will.deacon, stable,
	stable-commits, sudeep.holla

On Tue, Mar 15, 2016 at 02:08:19PM +0000, Lorenzo Pieralisi wrote:
> Hi Greg,
> 
> On Tue, Jan 26, 2016 at 10:54:50PM -0800, gregkh@linuxfoundation.org wrote:
> > 
> > This is a note to let you know that I've just added the patch titled
> > 
> >     arm64: kernel: pause/unpause function graph tracer in cpu_suspend()
> > 
> > to the 4.1-stable tree which can be found at:
> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > 
> > The filename of the patch is:
> >      arm64-kernel-pause-unpause-function-graph-tracer-in-cpu_suspend.patch
> > and it can be found in the queue-4.1 subdirectory.
> > 
> > If you, or anyone else, feels it should not be added to the stable tree,
> > please let <stable@vger.kernel.org> know about it.
> 
> We have just noticed this patch did not make it to 3.18 stable kernel
> even though it was marked for #3.16+, probably it has slipped through
> the cracks, please let us know what we can do to get it applied
> to the 3.18 stable tree.

Why ask me, I'm not in charge of the 3.18 stable tree?

Hint, use https://www.kernel.org/category/releases.html in the future...

And do people really even use 3.18 for arm64 these days?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch "arm64: kernel: pause/unpause function graph tracer in cpu_suspend()" has been added to the 4.1-stable tree
  2016-03-15 15:04   ` Greg KH
@ 2016-03-15 16:28     ` Lorenzo Pieralisi
  0 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Pieralisi @ 2016-03-15 16:28 UTC (permalink / raw)
  To: Greg KH
  Cc: catalin.marinas, rostedt, takahiro.akashi, will.deacon, stable,
	stable-commits, sudeep.holla

On Tue, Mar 15, 2016 at 08:04:39AM -0700, Greg KH wrote:
> On Tue, Mar 15, 2016 at 02:08:19PM +0000, Lorenzo Pieralisi wrote:
> > Hi Greg,
> > 
> > On Tue, Jan 26, 2016 at 10:54:50PM -0800, gregkh@linuxfoundation.org wrote:
> > > 
> > > This is a note to let you know that I've just added the patch titled
> > > 
> > >     arm64: kernel: pause/unpause function graph tracer in cpu_suspend()
> > > 
> > > to the 4.1-stable tree which can be found at:
> > >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > > 
> > > The filename of the patch is:
> > >      arm64-kernel-pause-unpause-function-graph-tracer-in-cpu_suspend.patch
> > > and it can be found in the queue-4.1 subdirectory.
> > > 
> > > If you, or anyone else, feels it should not be added to the stable tree,
> > > please let <stable@vger.kernel.org> know about it.
> > 
> > We have just noticed this patch did not make it to 3.18 stable kernel
> > even though it was marked for #3.16+, probably it has slipped through
> > the cracks, please let us know what we can do to get it applied
> > to the 3.18 stable tree.
> 
> Why ask me, I'm not in charge of the 3.18 stable tree?
> 
> Hint, use https://www.kernel.org/category/releases.html in the future...

Ok, sorry for the noise, I will ask Sasha then, I just reused the 4.1
notification to enquire, wrongly.

> And do people really even use 3.18 for arm64 these days?

Yes, that's why I am asking for inclusion, we can debate whether that's
what they should do if I had an option to prevent that.

Thanks,
Lorenzo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-15 16:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-27  6:54 Patch "arm64: kernel: pause/unpause function graph tracer in cpu_suspend()" has been added to the 4.1-stable tree gregkh
2016-03-15 14:08 ` Lorenzo Pieralisi
2016-03-15 14:07   ` Steven Rostedt
2016-03-15 14:39     ` Lorenzo Pieralisi
2016-03-15 15:04   ` Greg KH
2016-03-15 16:28     ` Lorenzo Pieralisi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.