linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Fix  MAX_STACK_TRACE_ENTRIES too low warning again
@ 2013-05-07  2:32 Li Zhong
  2013-05-07  8:29 ` Li Zhong
  2013-05-07  8:44 ` [PATCH v2] " Li Zhong
  0 siblings, 2 replies; 3+ messages in thread
From: Li Zhong @ 2013-05-07  2:32 UTC (permalink / raw)
  To: PowerPC email list; +Cc: Paul Mackerras

Saw this warning again, and this time from the ret_from_fork path. 

It seems we could clear the back chain earlier in copy_thread(), which
could cover both path, and also fix potential lockdep usage in
schedule_tail(), or exception occurred before we clear the back chain.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/entry_32.S |    2 --
 arch/powerpc/kernel/entry_64.S |    2 --
 arch/powerpc/kernel/process.c  |    1 +
 3 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index e514de5..d22e73e 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -439,8 +439,6 @@ ret_from_fork:
 ret_from_kernel_thread:
 	REST_NVGPRS(r1)
 	bl	schedule_tail
-	li	r3,0
-	stw	r3,0(r1)
 	mtlr	r14
 	mr	r3,r15
 	PPC440EP_ERR42
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 3fe5259..48e8a86 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -376,8 +376,6 @@ _GLOBAL(ret_from_fork)
 _GLOBAL(ret_from_kernel_thread)
 	bl	.schedule_tail
 	REST_NVGPRS(r1)
-	li	r3,0
-	std	r3,0(r1)
 	ld	r14, 0(r14)
 	mtlr	r14
 	mr	r3,r15
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ceb4e7b..2c9fc5e 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -973,6 +973,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 	 */
 	sp -= sizeof(struct pt_regs);
 	kregs = (struct pt_regs *) sp;
+	kregs->gpr[1] = 0;
 	sp -= STACK_FRAME_OVERHEAD;
 	p->thread.ksp = sp;
 	p->thread.ksp_limit = (unsigned long)task_stack_page(p) +
-- 
1.7.1

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

* Re: [PATCH] powerpc: Fix  MAX_STACK_TRACE_ENTRIES too low warning again
  2013-05-07  2:32 [PATCH] powerpc: Fix MAX_STACK_TRACE_ENTRIES too low warning again Li Zhong
@ 2013-05-07  8:29 ` Li Zhong
  2013-05-07  8:44 ` [PATCH v2] " Li Zhong
  1 sibling, 0 replies; 3+ messages in thread
From: Li Zhong @ 2013-05-07  8:29 UTC (permalink / raw)
  To: PowerPC email list; +Cc: Paul Mackerras

On Tue, 2013-05-07 at 10:32 +0800, Li Zhong wrote:
> Saw this warning again, and this time from the ret_from_fork path. 
> 
> It seems we could clear the back chain earlier in copy_thread(), which
> could cover both path, and also fix potential lockdep usage in
> schedule_tail(), or exception occurred before we clear the back chain.

Sorry, I made some mistake, please ignore this patch...
It seems clearing the back chain shouldn't use kregs->gpr[1] below, it
should be ((unsigned long*)sp)[0]. I'll send an updated version.

Thanks, Zhong

> 
> Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
> ---
>  arch/powerpc/kernel/entry_32.S |    2 --
>  arch/powerpc/kernel/entry_64.S |    2 --
>  arch/powerpc/kernel/process.c  |    1 +
>  3 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
> index e514de5..d22e73e 100644
> --- a/arch/powerpc/kernel/entry_32.S
> +++ b/arch/powerpc/kernel/entry_32.S
> @@ -439,8 +439,6 @@ ret_from_fork:
>  ret_from_kernel_thread:
>  	REST_NVGPRS(r1)
>  	bl	schedule_tail
> -	li	r3,0
> -	stw	r3,0(r1)
>  	mtlr	r14
>  	mr	r3,r15
>  	PPC440EP_ERR42
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index 3fe5259..48e8a86 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -376,8 +376,6 @@ _GLOBAL(ret_from_fork)
>  _GLOBAL(ret_from_kernel_thread)
>  	bl	.schedule_tail
>  	REST_NVGPRS(r1)
> -	li	r3,0
> -	std	r3,0(r1)
>  	ld	r14, 0(r14)
>  	mtlr	r14
>  	mr	r3,r15
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index ceb4e7b..2c9fc5e 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -973,6 +973,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
>  	 */
>  	sp -= sizeof(struct pt_regs);
>  	kregs = (struct pt_regs *) sp;
> +	kregs->gpr[1] = 0;
>  	sp -= STACK_FRAME_OVERHEAD;
>  	p->thread.ksp = sp;
>  	p->thread.ksp_limit = (unsigned long)task_stack_page(p) +

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

* [PATCH v2] powerpc: Fix  MAX_STACK_TRACE_ENTRIES too low warning again
  2013-05-07  2:32 [PATCH] powerpc: Fix MAX_STACK_TRACE_ENTRIES too low warning again Li Zhong
  2013-05-07  8:29 ` Li Zhong
@ 2013-05-07  8:44 ` Li Zhong
  1 sibling, 0 replies; 3+ messages in thread
From: Li Zhong @ 2013-05-07  8:44 UTC (permalink / raw)
  To: PowerPC email list; +Cc: Paul Mackerras

Saw this warning again, and this time from the ret_from_fork path. 

It seems we could clear the back chain earlier in copy_thread(), which
could cover both path, and also fix potential lockdep usage in
schedule_tail(), or exception occurred before we clear the back chain.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
--- 
 arch/powerpc/kernel/entry_32.S |    2 --
 arch/powerpc/kernel/entry_64.S |    2 --
 arch/powerpc/kernel/process.c  |    1 +
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index e514de5..d22e73e 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -439,8 +439,6 @@ ret_from_fork:
 ret_from_kernel_thread:
 	REST_NVGPRS(r1)
 	bl	schedule_tail
-	li	r3,0
-	stw	r3,0(r1)
 	mtlr	r14
 	mr	r3,r15
 	PPC440EP_ERR42
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 3fe5259..48e8a86 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -376,8 +376,6 @@ _GLOBAL(ret_from_fork)
 _GLOBAL(ret_from_kernel_thread)
 	bl	.schedule_tail
 	REST_NVGPRS(r1)
-	li	r3,0
-	std	r3,0(r1)
 	ld	r14, 0(r14)
 	mtlr	r14
 	mr	r3,r15
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ceb4e7b..80af366 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -971,6 +971,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 	 * do some house keeping and then return from the fork or clone
 	 * system call, using the stack frame created above.
 	 */
+	((unsigned long *)sp)[0] = 0;
 	sp -= sizeof(struct pt_regs);
 	kregs = (struct pt_regs *) sp;
 	sp -= STACK_FRAME_OVERHEAD;

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

end of thread, other threads:[~2013-05-07  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-07  2:32 [PATCH] powerpc: Fix MAX_STACK_TRACE_ENTRIES too low warning again Li Zhong
2013-05-07  8:29 ` Li Zhong
2013-05-07  8:44 ` [PATCH v2] " Li Zhong

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).