Skip to content

Commit 72b11aa

Browse files
KAGA-KOKOPeter Zijlstra
authored andcommitted
riscv: Switch to hotplug core state synchronization
Switch to the CPU hotplug core state tracking and synchronization mechanim. No functional change intended. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Palmer Dabbelt <palmer@rivosinc.com> Tested-by: Michael Kelley <mikelley@microsoft.com> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> Tested-by: Helge Deller <deller@gmx.de> # parisc Tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com> # Steam Deck Link: https://lore.kernel.org/r/20230512205256.916055844@linutronix.de
1 parent 51e0efe commit 72b11aa

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

arch/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ config RISCV
122122
select HAVE_RSEQ
123123
select HAVE_STACKPROTECTOR
124124
select HAVE_SYSCALL_TRACEPOINTS
125+
select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
125126
select IRQ_DOMAIN
126127
select IRQ_FORCED_THREADING
127128
select KASAN_VMALLOC if KASAN

arch/riscv/include/asm/smp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ asmlinkage void smp_callin(void);
7070

7171
#if defined CONFIG_HOTPLUG_CPU
7272
int __cpu_disable(void);
73-
void __cpu_die(unsigned int cpu);
73+
static inline void __cpu_die(unsigned int cpu) { }
7474
#endif /* CONFIG_HOTPLUG_CPU */
7575

7676
#else

arch/riscv/kernel/cpu-hotplug.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/sched.h>
99
#include <linux/err.h>
1010
#include <linux/irq.h>
11+
#include <linux/cpuhotplug.h>
1112
#include <linux/cpu.h>
1213
#include <linux/sched/hotplug.h>
1314
#include <asm/irq.h>
@@ -49,17 +50,15 @@ int __cpu_disable(void)
4950
return ret;
5051
}
5152

53+
#ifdef CONFIG_HOTPLUG_CPU
5254
/*
53-
* Called on the thread which is asking for a CPU to be shutdown.
55+
* Called on the thread which is asking for a CPU to be shutdown, if the
56+
* CPU reported dead to the hotplug core.
5457
*/
55-
void __cpu_die(unsigned int cpu)
58+
void arch_cpuhp_cleanup_dead_cpu(unsigned int cpu)
5659
{
5760
int ret = 0;
5861

59-
if (!cpu_wait_death(cpu, 5)) {
60-
pr_err("CPU %u: didn't die\n", cpu);
61-
return;
62-
}
6362
pr_notice("CPU%u: off\n", cpu);
6463

6564
/* Verify from the firmware if the cpu is really stopped*/
@@ -76,9 +75,10 @@ void __noreturn arch_cpu_idle_dead(void)
7675
{
7776
idle_task_exit();
7877

79-
(void)cpu_report_death();
78+
cpuhp_ap_report_dead();
8079

8180
cpu_ops[smp_processor_id()]->cpu_stop();
8281
/* It should never reach here */
8382
BUG();
8483
}
84+
#endif

0 commit comments

Comments
 (0)