Linux-RISC-V Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] riscv: to make sure the cores in .Lsecondary_park
@ 2020-01-08  2:40 Greentime Hu
  2020-01-08  3:36 ` Anup Patel
  2020-01-08  8:40 ` Andreas Schwab
  0 siblings, 2 replies; 4+ messages in thread
From: Greentime Hu @ 2020-01-08  2:40 UTC (permalink / raw)
  To: green.hu, greentime, paul.walmsley, palmer, linux-riscv, linux-kernel
  Cc: Greentime Hu

The code in secondary_park is currently placed in the .init section.  The
kernel reclaims and clears this code when it finishes booting.  That
causes the cores parked in it to go to somewhere unpredictable, so we
move this function out of init to make sure the cores stay looping there.

Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
---
 arch/riscv/kernel/head.S | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index f8f996916c5b..276b98f9d0bd 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -217,11 +217,6 @@ relocate:
 	tail smp_callin
 #endif
 
-.align 2
-.Lsecondary_park:
-	/* We lack SMP support or have too many harts, so park this hart */
-	wfi
-	j .Lsecondary_park
 END(_start)
 
 #ifdef CONFIG_RISCV_M_MODE
@@ -303,6 +298,13 @@ ENTRY(reset_regs)
 END(reset_regs)
 #endif /* CONFIG_RISCV_M_MODE */
 
+.section ".text", "ax",@progbits
+.align 2
+.Lsecondary_park:
+	/* We lack SMP support or have too many harts, so park this hart */
+	wfi
+	j .Lsecondary_park
+
 __PAGE_ALIGNED_BSS
 	/* Empty zero page */
 	.balign PAGE_SIZE
-- 
2.17.1



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

* Re: [PATCH v2] riscv: to make sure the cores in .Lsecondary_park
  2020-01-08  2:40 [PATCH v2] riscv: to make sure the cores in .Lsecondary_park Greentime Hu
@ 2020-01-08  3:36 ` Anup Patel
  2020-01-08  8:40 ` Andreas Schwab
  1 sibling, 0 replies; 4+ messages in thread
From: Anup Patel @ 2020-01-08  3:36 UTC (permalink / raw)
  To: Greentime Hu
  Cc: linux-kernel@vger.kernel.org List, Palmer Dabbelt, Greentime Hu,
	Paul Walmsley, greentime, linux-riscv

On Wed, Jan 8, 2020 at 8:10 AM Greentime Hu <greentime.hu@sifive.com> wrote:
>
> The code in secondary_park is currently placed in the .init section.  The
> kernel reclaims and clears this code when it finishes booting.  That
> causes the cores parked in it to go to somewhere unpredictable, so we
> move this function out of init to make sure the cores stay looping there.
>
> Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
> ---
>  arch/riscv/kernel/head.S | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
> index f8f996916c5b..276b98f9d0bd 100644
> --- a/arch/riscv/kernel/head.S
> +++ b/arch/riscv/kernel/head.S
> @@ -217,11 +217,6 @@ relocate:
>         tail smp_callin
>  #endif
>
> -.align 2
> -.Lsecondary_park:
> -       /* We lack SMP support or have too many harts, so park this hart */
> -       wfi
> -       j .Lsecondary_park
>  END(_start)
>
>  #ifdef CONFIG_RISCV_M_MODE
> @@ -303,6 +298,13 @@ ENTRY(reset_regs)
>  END(reset_regs)
>  #endif /* CONFIG_RISCV_M_MODE */
>
> +.section ".text", "ax",@progbits
> +.align 2
> +.Lsecondary_park:
> +       /* We lack SMP support or have too many harts, so park this hart */
> +       wfi
> +       j .Lsecondary_park
> +
>  __PAGE_ALIGNED_BSS
>         /* Empty zero page */
>         .balign PAGE_SIZE
> --
> 2.17.1
>

LGTM.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup


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

* Re: [PATCH v2] riscv: to make sure the cores in .Lsecondary_park
  2020-01-08  2:40 [PATCH v2] riscv: to make sure the cores in .Lsecondary_park Greentime Hu
  2020-01-08  3:36 ` Anup Patel
@ 2020-01-08  8:40 ` Andreas Schwab
  2020-01-09  3:10   ` Greentime Hu
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2020-01-08  8:40 UTC (permalink / raw)
  To: Greentime Hu
  Cc: linux-kernel, palmer, green.hu, paul.walmsley, greentime, linux-riscv

The subject is missing a verb.

riscv: make sure the cores stay looping in .Lsecondary_park

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


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

* Re: [PATCH v2] riscv: to make sure the cores in .Lsecondary_park
  2020-01-08  8:40 ` Andreas Schwab
@ 2020-01-09  3:10   ` Greentime Hu
  0 siblings, 0 replies; 4+ messages in thread
From: Greentime Hu @ 2020-01-09  3:10 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Linux Kernel Mailing List, Palmer Dabbelt, Gt, Paul Walmsley,
	greentime, linux-riscv

On Wed, Jan 8, 2020 at 4:41 PM Andreas Schwab <schwab@suse.de> wrote:
>
> The subject is missing a verb.
>
> riscv: make sure the cores stay looping in .Lsecondary_park
>

Thank you, Andreas.
I will send v3 to fix this. :)


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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08  2:40 [PATCH v2] riscv: to make sure the cores in .Lsecondary_park Greentime Hu
2020-01-08  3:36 ` Anup Patel
2020-01-08  8:40 ` Andreas Schwab
2020-01-09  3:10   ` Greentime Hu

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org
	public-inbox-index linux-riscv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git