diff --git a/anolis/configs/L2-OPTIONAL/riscv/CONFIG_HOTPLUG_CORE_SYNC_FULL b/anolis/configs/L2-OPTIONAL/riscv/CONFIG_HOTPLUG_CORE_SYNC_FULL new file mode 100644 index 0000000000000000000000000000000000000000..74e300e560120c265a8fc16e7ecbc4bf27ee4f05 --- /dev/null +++ b/anolis/configs/L2-OPTIONAL/riscv/CONFIG_HOTPLUG_CORE_SYNC_FULL @@ -0,0 +1 @@ +CONFIG_HOTPLUG_CORE_SYNC_FULL=y diff --git a/anolis/configs/L2-OPTIONAL/riscv/CONFIG_HOTPLUG_PARALLEL b/anolis/configs/L2-OPTIONAL/riscv/CONFIG_HOTPLUG_PARALLEL new file mode 100644 index 0000000000000000000000000000000000000000..5eac1fd8ef52fb2905477822b9d52f98b491f4bb --- /dev/null +++ b/anolis/configs/L2-OPTIONAL/riscv/CONFIG_HOTPLUG_PARALLEL @@ -0,0 +1 @@ +CONFIG_HOTPLUG_PARALLEL=y diff --git a/anolis/configs/L2-OPTIONAL/riscv/CONFIG_HOTPLUG_SPLIT_STARTUP b/anolis/configs/L2-OPTIONAL/riscv/CONFIG_HOTPLUG_SPLIT_STARTUP new file mode 100644 index 0000000000000000000000000000000000000000..9ba8dd70d43d0d87e9413b9c513b5d9c67c65849 --- /dev/null +++ b/anolis/configs/L2-OPTIONAL/riscv/CONFIG_HOTPLUG_SPLIT_STARTUP @@ -0,0 +1 @@ +CONFIG_HOTPLUG_SPLIT_STARTUP=y diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index d7bf85e751826210fab145b244de787381aa92f6..66830f8d74bec8b5fd49b27a267e160b67f06ed3 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -165,7 +165,7 @@ config RISCV select HAVE_SAMPLE_FTRACE_DIRECT_MULTI select HAVE_STACKPROTECTOR select HAVE_SYSCALL_TRACEPOINTS - select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU + select HOTPLUG_PARALLEL if HOTPLUG_CPU select IRQ_DOMAIN select IRQ_FORCED_THREADING select KASAN_VMALLOC if KASAN diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index ccab85f8748f49ec8e63566249d254abd2732087..a13491ca92f3fc0551c477904cf5de6daef067f5 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -40,7 +40,9 @@ #include "head.h" +#ifndef CONFIG_HOTPLUG_PARALLEL static DECLARE_COMPLETION(cpu_running); +#endif void __init smp_prepare_boot_cpu(void) { @@ -202,6 +204,12 @@ static int start_secondary_cpu(int cpu, struct task_struct *tidle) return -EOPNOTSUPP; } +#ifdef CONFIG_HOTPLUG_PARALLEL +int arch_cpuhp_kick_ap_alive(unsigned int cpu, struct task_struct *tidle) +{ + return start_secondary_cpu(cpu, tidle); +} +#else int __cpu_up(unsigned int cpu, struct task_struct *tidle) { int ret = 0; @@ -222,6 +230,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) return ret; } +#endif void __init smp_cpus_done(unsigned int max_cpus) { @@ -248,6 +257,10 @@ asmlinkage __visible void smp_callin(void) mmgrab(mm); current->active_mm = mm; +#ifdef CONFIG_HOTPLUG_PARALLEL + cpuhp_ap_sync_alive(); +#endif + store_cpu_topology(curr_cpuid); notify_cpu_starting(curr_cpuid); @@ -261,7 +274,9 @@ asmlinkage __visible void smp_callin(void) * a local TLB flush right now just in case. */ local_flush_tlb_all(); +#ifndef CONFIG_HOTPLUG_PARALLEL complete(&cpu_running); +#endif /* * Disable preemption before enabling interrupts, so we don't try to * schedule a CPU that hasn't actually started yet. diff --git a/kernel/cpu.c b/kernel/cpu.c index 2068818604e307f2bf74cee6e2dafd7fecda8cf3..33a08cd58bc62b0869270bb0f8f048102dc0053b 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1846,6 +1846,7 @@ static int __init parallel_bringup_parse_param(char *arg) } early_param("cpuhp.parallel", parallel_bringup_parse_param); +#ifdef CONFIG_HOTPLUG_SMT static inline bool cpuhp_smt_aware(void) { return cpu_smt_max_threads > 1; @@ -1855,6 +1856,21 @@ static inline const struct cpumask *cpuhp_get_primary_thread_mask(void) { return cpu_primary_thread_mask; } +#else +static inline bool cpuhp_smt_aware(void) +{ + return false; +} +static inline const struct cpumask *cpuhp_get_primary_thread_mask(void) +{ + return cpu_none_mask; +} +#endif + +bool __weak arch_cpuhp_init_parallel_bringup(void) +{ + return true; +} /* * On architectures which have enabled parallel bringup this invokes all BP