All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: zboot: Avoid endless loop in clear BSS.
@ 2021-01-06  0:47 Jinyang He
  2021-01-06  2:04 ` Jiaxun Yang
  2021-01-07 16:28 ` Thomas Bogendoerfer
  0 siblings, 2 replies; 3+ messages in thread
From: Jinyang He @ 2021-01-06  0:47 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Jiaxun Yang; +Cc: linux-mips, linux-kernel

Commit 2ee1503e546f ("MIPS: zboot: head.S clean up").

After .noreorder removed, clear BSS fall into endless loop. The bne
instruction will add nop to the delay slot at compile time. So a0
register will not increment by 4. Fix it and clear BSS from _edata
to (_end - 1).

Signed-off-by: Jinyang He <hejinyang@loongson.cn>
---
 arch/mips/boot/compressed/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
index 070b2fb..5795d0a 100644
--- a/arch/mips/boot/compressed/head.S
+++ b/arch/mips/boot/compressed/head.S
@@ -26,8 +26,8 @@
 	PTR_LA	a0, _edata
 	PTR_LA	a2, _end
 1:	sw	zero, 0(a0)
+	addiu	a0, a0, 4
 	bne	a2, a0, 1b
-	 addiu	a0, a0, 4
 
 	PTR_LA	a0, (.heap)	     /* heap address */
 	PTR_LA	sp, (.stack + 8192)  /* stack address */
-- 
2.1.0


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

* Re: [PATCH] MIPS: zboot: Avoid endless loop in clear BSS.
  2021-01-06  0:47 [PATCH] MIPS: zboot: Avoid endless loop in clear BSS Jinyang He
@ 2021-01-06  2:04 ` Jiaxun Yang
  2021-01-07 16:28 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Jiaxun Yang @ 2021-01-06  2:04 UTC (permalink / raw)
  To: Jinyang He, Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel



On Wed, Jan 6, 2021, at 8:47 AM, Jinyang He wrote:
> Commit 2ee1503e546f ("MIPS: zboot: head.S clean up").
> 
> After .noreorder removed, clear BSS fall into endless loop. The bne
> instruction will add nop to the delay slot at compile time. So a0
> register will not increment by 4. Fix it and clear BSS from _edata
> to (_end - 1).

Oops, my fault.
My QEMU based local test setup somehow never really tested zboot.

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

Thanks!

- Jiaxun

> 
> Signed-off-by: Jinyang He <hejinyang@loongson.cn>
> ---
>  arch/mips/boot/compressed/head.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
> index 070b2fb..5795d0a 100644
> --- a/arch/mips/boot/compressed/head.S
> +++ b/arch/mips/boot/compressed/head.S
> @@ -26,8 +26,8 @@
>  	PTR_LA	a0, _edata
>  	PTR_LA	a2, _end
>  1:	sw	zero, 0(a0)
> +	addiu	a0, a0, 4
>  	bne	a2, a0, 1b
> -	 addiu	a0, a0, 4
>  
>  	PTR_LA	a0, (.heap)	     /* heap address */
>  	PTR_LA	sp, (.stack + 8192)  /* stack address */
> -- 
> 2.1.0
> 
>

-- 
- Jiaxun

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

* Re: [PATCH] MIPS: zboot: Avoid endless loop in clear BSS.
  2021-01-06  0:47 [PATCH] MIPS: zboot: Avoid endless loop in clear BSS Jinyang He
  2021-01-06  2:04 ` Jiaxun Yang
@ 2021-01-07 16:28 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2021-01-07 16:28 UTC (permalink / raw)
  To: Jinyang He; +Cc: Jiaxun Yang, linux-mips, linux-kernel

On Wed, Jan 06, 2021 at 08:47:39AM +0800, Jinyang He wrote:
> Commit 2ee1503e546f ("MIPS: zboot: head.S clean up").
> 
> After .noreorder removed, clear BSS fall into endless loop. The bne
> instruction will add nop to the delay slot at compile time. So a0
> register will not increment by 4. Fix it and clear BSS from _edata
> to (_end - 1).
> 
> Signed-off-by: Jinyang He <hejinyang@loongson.cn>
> ---
>  arch/mips/boot/compressed/head.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2021-01-07 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06  0:47 [PATCH] MIPS: zboot: Avoid endless loop in clear BSS Jinyang He
2021-01-06  2:04 ` Jiaxun Yang
2021-01-07 16:28 ` Thomas Bogendoerfer

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.