linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: make cpu_init() notrace
@ 2013-04-18 16:20 Jon Medhurst (Tixy)
  2013-04-19 21:37 ` Nicolas Pitre
  2013-04-22 14:07 ` Russell King - ARM Linux
  0 siblings, 2 replies; 6+ messages in thread
From: Jon Medhurst (Tixy) @ 2013-04-18 16:20 UTC (permalink / raw)
  To: linux-arm-kernel

On resume from CPU power down any trace hooks enabled in cpu_init()
will get called before that function has done set_my_cpu_offset(),
so any use of per-cpu variables by trace hook code will cause bad
things to happen. Prevent this by marking the function notrace.

This fixes lockups/crashes seen when enabling function tracer on TC2
with the not yet mainlined cpuidle driver.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
---
 arch/arm/kernel/setup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index d343a6c..943cbf0 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -390,7 +390,7 @@ static void __init feat_v6_fixup(void)
  *
  * cpu_init sets up the per-CPU stacks.
  */
-void cpu_init(void)
+void notrace cpu_init(void)
 {
 	unsigned int cpu = smp_processor_id();
 	struct stack *stk = &stacks[cpu];
-- 
1.7.10.4

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

* [PATCH] ARM: make cpu_init() notrace
  2013-04-18 16:20 [PATCH] ARM: make cpu_init() notrace Jon Medhurst (Tixy)
@ 2013-04-19 21:37 ` Nicolas Pitre
  2013-04-22 14:07 ` Russell King - ARM Linux
  1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Pitre @ 2013-04-19 21:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 18 Apr 2013, Jon Medhurst (Tixy) wrote:

> On resume from CPU power down any trace hooks enabled in cpu_init()
> will get called before that function has done set_my_cpu_offset(),
> so any use of per-cpu variables by trace hook code will cause bad
> things to happen. Prevent this by marking the function notrace.
> 
> This fixes lockups/crashes seen when enabling function tracer on TC2
> with the not yet mainlined cpuidle driver.

This has potential to fix things on other platforms too.

> 
> Signed-off-by: Jon Medhurst <tixy@linaro.org>

Acked-by: Nicolas Pitre <nico@linaro.org>

I think you may send it to RMK's patch system.


> ---
>  arch/arm/kernel/setup.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index d343a6c..943cbf0 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -390,7 +390,7 @@ static void __init feat_v6_fixup(void)
>   *
>   * cpu_init sets up the per-CPU stacks.
>   */
> -void cpu_init(void)
> +void notrace cpu_init(void)
>  {
>  	unsigned int cpu = smp_processor_id();
>  	struct stack *stk = &stacks[cpu];
> -- 
> 1.7.10.4
> 
> 

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

* [PATCH] ARM: make cpu_init() notrace
  2013-04-18 16:20 [PATCH] ARM: make cpu_init() notrace Jon Medhurst (Tixy)
  2013-04-19 21:37 ` Nicolas Pitre
@ 2013-04-22 14:07 ` Russell King - ARM Linux
  2013-04-22 18:08   ` Jon Medhurst (Tixy)
  1 sibling, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2013-04-22 14:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 18, 2013 at 05:20:46PM +0100, Jon Medhurst (Tixy) wrote:
> On resume from CPU power down any trace hooks enabled in cpu_init()
> will get called before that function has done set_my_cpu_offset(),
> so any use of per-cpu variables by trace hook code will cause bad
> things to happen. Prevent this by marking the function notrace.
> 
> This fixes lockups/crashes seen when enabling function tracer on TC2
> with the not yet mainlined cpuidle driver.

Looks sane.  Needs to go to the patch system though.  Not sure if it'll
make 3.9 given its proximity (we're on -rc8).

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

* [PATCH] ARM: make cpu_init() notrace
  2013-04-22 14:07 ` Russell King - ARM Linux
@ 2013-04-22 18:08   ` Jon Medhurst (Tixy)
  2013-04-25 12:15     ` Russell King - ARM Linux
  0 siblings, 1 reply; 6+ messages in thread
From: Jon Medhurst (Tixy) @ 2013-04-22 18:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2013-04-22 at 15:07 +0100, Russell King - ARM Linux wrote:
> On Thu, Apr 18, 2013 at 05:20:46PM +0100, Jon Medhurst (Tixy) wrote:
> > On resume from CPU power down any trace hooks enabled in cpu_init()
> > will get called before that function has done set_my_cpu_offset(),
> > so any use of per-cpu variables by trace hook code will cause bad
> > things to happen. Prevent this by marking the function notrace.
> > 
> > This fixes lockups/crashes seen when enabling function tracer on TC2
> > with the not yet mainlined cpuidle driver.
> 
> Looks sane.  Needs to go to the patch system though.  Not sure if it'll
> make 3.9 given its proximity (we're on -rc8).

Added as patch 7700/1. Don't think there is a big rush as the problem
has probably been there since 3.8 when commit 14318efb (implement
optimized percpu variable access) started using TPIDRPRW; which is
presumably lost over CPU power down.

-- 
Tixy

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

* [PATCH] ARM: make cpu_init() notrace
  2013-04-22 18:08   ` Jon Medhurst (Tixy)
@ 2013-04-25 12:15     ` Russell King - ARM Linux
  2013-04-25 13:50       ` Jon Medhurst (Tixy)
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2013-04-25 12:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Apr 22, 2013 at 07:08:36PM +0100, Jon Medhurst (Tixy) wrote:
> On Mon, 2013-04-22 at 15:07 +0100, Russell King - ARM Linux wrote:
> > On Thu, Apr 18, 2013 at 05:20:46PM +0100, Jon Medhurst (Tixy) wrote:
> > > On resume from CPU power down any trace hooks enabled in cpu_init()
> > > will get called before that function has done set_my_cpu_offset(),
> > > so any use of per-cpu variables by trace hook code will cause bad
> > > things to happen. Prevent this by marking the function notrace.
> > > 
> > > This fixes lockups/crashes seen when enabling function tracer on TC2
> > > with the not yet mainlined cpuidle driver.
> > 
> > Looks sane.  Needs to go to the patch system though.  Not sure if it'll
> > make 3.9 given its proximity (we're on -rc8).
> 
> Added as patch 7700/1. Don't think there is a big rush as the problem
> has probably been there since 3.8 when commit 14318efb (implement
> optimized percpu variable access) started using TPIDRPRW; which is
> presumably lost over CPU power down.

$ pdb getpatch 7700/1 |tr ' ' '_' |less
diff_--git_a/arch/arm/kernel/setup.c_b/arch/arm/kernel/setup.c
index_d343a6c..943cbf0_100644
---_a/arch/arm/kernel/setup.c
+++_b/arch/arm/kernel/setup.c
@@_-390,7_+390,7_@@_static_void___init_feat_v6_fixup(void)
__*
__*_cpu_init_sets_up_the_per-CPU_stacks.
__*/
-void_cpu_init(void)
+void_notrace_cpu_init(void)
_{
________unsigned_int_cpu_=_smp_processor_id();
________struct_stack_*stk_=_&stacks[cpu];

Can you guess why git has a problem appying the above... you seem to
have sent the patch from your mailer, I guess your mailer thinks it
knows better when it comes to what characters should be in your
message... or maybe its a cut'n'paste issue?

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

* [PATCH] ARM: make cpu_init() notrace
  2013-04-25 12:15     ` Russell King - ARM Linux
@ 2013-04-25 13:50       ` Jon Medhurst (Tixy)
  0 siblings, 0 replies; 6+ messages in thread
From: Jon Medhurst (Tixy) @ 2013-04-25 13:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2013-04-25 at 13:15 +0100, Russell King - ARM Linux wrote:

> $ pdb getpatch 7700/1 |tr ' ' '_' |less
> diff_--git_a/arch/arm/kernel/setup.c_b/arch/arm/kernel/setup.c
> index_d343a6c..943cbf0_100644
> ---_a/arch/arm/kernel/setup.c
> +++_b/arch/arm/kernel/setup.c
> @@_-390,7_+390,7_@@_static_void___init_feat_v6_fixup(void)
> __*
> __*_cpu_init_sets_up_the_per-CPU_stacks.
> __*/
> -void_cpu_init(void)
> +void_notrace_cpu_init(void)
> _{
> ________unsigned_int_cpu_=_smp_processor_id();
> ________struct_stack_*stk_=_&stacks[cpu];
> 
> Can you guess why git has a problem appying the above... 

Sorry about that, the user forgot to tell their mailer it was
pre-formatted text. I've sent a fixed version.

Note to self: bcc self on patch submissions and then run them though
'git am' to catch problems before others hit them.

-- 
Tixy

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

end of thread, other threads:[~2013-04-25 13:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18 16:20 [PATCH] ARM: make cpu_init() notrace Jon Medhurst (Tixy)
2013-04-19 21:37 ` Nicolas Pitre
2013-04-22 14:07 ` Russell King - ARM Linux
2013-04-22 18:08   ` Jon Medhurst (Tixy)
2013-04-25 12:15     ` Russell King - ARM Linux
2013-04-25 13:50       ` Jon Medhurst (Tixy)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).