Commit a0f11dff authored by Wang Yuanheng's avatar Wang Yuanheng Committed by guzitao
Browse files

sw64: fix secondary cpu bring up bug

Sunway inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB73UR



--------------------------------

If smp_rcb->ready is set after secondary cpu receives reset
signal, the secondary cpu may fail to wake up.

Signed-off-by: default avatarWang Yuanheng <wangyuanheng@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent 13e8251f
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -139,6 +139,9 @@ static int secondary_cpu_start(int cpuid, struct task_struct *idle)

	set_secondary_ready(cpuid);

	/* send reset signal */
	reset_cpu(cpuid);

	/* Wait 10 seconds for secondary cpu.  */
	timeout = jiffies + 10*HZ;
	while (time_before(jiffies, timeout)) {
@@ -318,7 +321,6 @@ int vt_cpu_up(unsigned int cpu, struct task_struct *tidle)
	wmb();
	smp_rcb->ready = 0;
	/* irq must be disabled before reset vCPU */
	reset_cpu(cpu);
	smp_boot_one_cpu(cpu, tidle);

	return cpu_online(cpu) ? 0 : -EIO;
@@ -340,13 +342,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
	/* send wake up signal */
	send_wakeup_interrupt(cpu);
#endif
	/* send reset signal */
	if (is_in_host()) {
		reset_cpu(cpu);
	} else {
		while (1)
			cpu_relax();
	}
	smp_boot_one_cpu(cpu, tidle);

#ifdef CONFIG_SUBARCH_C3B