Skip to contentSkip to conversation

powerpc: Fix MAX_STACK_TRACE_ENTRIES too low warning again

PATCH Superseded Li Zhong 1 participant 3 messages May 7, 2013 PowerPC

lore
Share & tools
lore

Li Zhong

author
#0 lore raw

PATCH 1/1 powerpc: Fix MAX_STACK_TRACE_ENTRIES too low warning again

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.

---
 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(-)
arch/powerpc/kernel/entry_32.S +0 -2
index e514de5..d22e73e 100644
@@ -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
arch/powerpc/kernel/entry_64.S +0 -2
index 3fe5259..48e8a86 100644
@@ -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
arch/powerpc/kernel/process.c +1 -0
index ceb4e7b..2c9fc5e 100644
@@ -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) +
Signature · 1 line
1.7.1
author
#1 lore raw
Quoted 5 lines · Li Zhong

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

Quoted 46 lines
---
 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(-)
arch/powerpc/kernel/entry_32.S +0 -2
index e514de5..d22e73e 100644
@@ -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
arch/powerpc/kernel/entry_64.S +0 -2
index 3fe5259..48e8a86 100644
@@ -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
arch/powerpc/kernel/process.c +1 -0
index ceb4e7b..2c9fc5e 100644
@@ -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) +
author
#2 lore raw

PATCH v2 1/1 powerpc: Fix MAX_STACK_TRACE_ENTRIES too low warning again

In reply to Li Zhong

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.

---

 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(-)
arch/powerpc/kernel/entry_32.S +0 -2
index e514de5..d22e73e 100644
@@ -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
arch/powerpc/kernel/entry_64.S +0 -2
index 3fe5259..48e8a86 100644
@@ -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
arch/powerpc/kernel/process.c +1 -0
index ceb4e7b..80af366 100644
@@ -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;