Skip to contentSkip to conversation

riscv: to make sure the cores in .Lsecondary_park

PATCH Superseded Greentime Hu 3 participants 4 messages Jan 8, 2020 – Jan 9, 2020 RISC-V

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 riscv: to make sure the cores in .Lsecondary_park

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.

---
 arch/riscv/kernel/head.S | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
arch/riscv/kernel/head.S +7 -5
index f8f996916c5b..276b98f9d0bd 100644
@@ -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
Signature · 1 line
2.17.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 42 lines · 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.

---
 arch/riscv/kernel/head.S | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
arch/riscv/kernel/head.S +7 -6
index f8f996916c5b..276b98f9d0bd 100644
@@ -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
--
Quoted 2 lines

2.17.1

LGTM.

Regards,
Anup

#2 lore raw
In reply to Greentime Hu

The subject is missing a verb.

riscv: make sure the cores stay looping in .Lsecondary_park

Andreas.

Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
#3 lore raw
Quoted 5 lines · Andreas Schwab

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