mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARM: rockchip: fix kernel hang during smp initialization
@ 2025-07-03 14:04 Alexander Kochetkov
  2025-07-14 15:08 ` Heiko Stuebner
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kochetkov @ 2025-07-03 14:04 UTC (permalink / raw)
  To: Russell King, Heiko Stuebner, linux-arm-kernel, linux-rockchip,
	linux-kernel
  Cc: Alexander Kochetkov

In order to bring up secondary CPUs main CPU write trampoline
code to SRAM. The trampoline code is written while secondary
CPUs are powered on (at least that true for RK3188 CPU).
Sometimes that leads to kernel hang. Probably because secondary
CPU execute trampoline code while kernel doesn't expect.

The patch moves SRAM initialization step to the point where all
secondary CPUs are powered down.

That fixes rarely hangs on RK3188:
[    0.091568] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.091996] rockchip_smp_prepare_cpus: ncores 4

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
---
 arch/arm/mach-rockchip/platsmp.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
index 36915a073c23..f432d22bfed8 100644
--- a/arch/arm/mach-rockchip/platsmp.c
+++ b/arch/arm/mach-rockchip/platsmp.c
@@ -279,11 +279,6 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
 	}
 
 	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
-		if (rockchip_smp_prepare_sram(node)) {
-			of_node_put(node);
-			return;
-		}
-
 		/* enable the SCU power domain */
 		pmu_set_power_domain(PMU_PWRDN_SCU, true);
 
@@ -316,11 +311,19 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
 		asm ("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr));
 		ncores = ((l2ctlr >> 24) & 0x3) + 1;
 	}
-	of_node_put(node);
 
 	/* Make sure that all cores except the first are really off */
 	for (i = 1; i < ncores; i++)
 		pmu_set_power_domain(0 + i, false);
+
+	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
+		if (rockchip_smp_prepare_sram(node)) {
+			of_node_put(node);
+			return;
+		}
+	}
+
+	of_node_put(node);
 }
 
 static void __init rk3036_smp_prepare_cpus(unsigned int max_cpus)
-- 
2.43.0


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

* Re: [PATCH] ARM: rockchip: fix kernel hang during smp initialization
  2025-07-03 14:04 [PATCH] ARM: rockchip: fix kernel hang during smp initialization Alexander Kochetkov
@ 2025-07-14 15:08 ` Heiko Stuebner
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Stuebner @ 2025-07-14 15:08 UTC (permalink / raw)
  To: Russell King, linux-arm-kernel, linux-rockchip, linux-kernel,
	Alexander Kochetkov
  Cc: Heiko Stuebner


On Thu, 03 Jul 2025 17:04:53 +0300, Alexander Kochetkov wrote:
> In order to bring up secondary CPUs main CPU write trampoline
> code to SRAM. The trampoline code is written while secondary
> CPUs are powered on (at least that true for RK3188 CPU).
> Sometimes that leads to kernel hang. Probably because secondary
> CPU execute trampoline code while kernel doesn't expect.
> 
> The patch moves SRAM initialization step to the point where all
> secondary CPUs are powered down.
> 
> [...]

Applied, thanks!

Gave this a spin on rk3066 + rk3188 + (not-A9) rk3288.
Both the affected SoCs as well as the rk3288 booted fine.


[1/1] ARM: rockchip: fix kernel hang during smp initialization
      commit: 7cdb433bb44cdc87dc5260cdf15bf03cc1cd1814

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

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

end of thread, other threads:[~2025-07-14 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-03 14:04 [PATCH] ARM: rockchip: fix kernel hang during smp initialization Alexander Kochetkov
2025-07-14 15:08 ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®