Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'smp-core-2020-06-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull SMP updates from Ingo Molnar:
"Misc cleanups in the SMP hotplug and cross-call code"

* tag 'smp-core-2020-06-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
cpu/hotplug: Remove __freeze_secondary_cpus()
cpu/hotplug: Remove disable_nonboot_cpus()
cpu/hotplug: Fix a typo in comment "broadacasted"->"broadcasted"
smp: Use smp_call_func_t in on_each_cpu()

+25 -36
+3 -3
Documentation/power/suspend-and-cpuhotplug.rst
··· 48 48 | 49 49 | 50 50 v 51 - disable_nonboot_cpus() 51 + freeze_secondary_cpus() 52 52 /* start */ 53 53 | 54 54 v ··· 83 83 Release cpu_add_remove_lock 84 84 | 85 85 v 86 - /* disable_nonboot_cpus() complete */ 86 + /* freeze_secondary_cpus() complete */ 87 87 | 88 88 v 89 89 Do suspend ··· 93 93 Resuming back is likewise, with the counterparts being (in the order of 94 94 execution during resume): 95 95 96 - * enable_nonboot_cpus() which involves:: 96 + * thaw_secondary_cpus() which involves:: 97 97 98 98 | Acquire cpu_add_remove_lock 99 99 | Decrease cpu_hotplug_disabled, thereby enabling regular cpu hotplug
+2 -2
arch/x86/kernel/smpboot.c
··· 1384 1384 speculative_store_bypass_ht_init(); 1385 1385 } 1386 1386 1387 - void arch_enable_nonboot_cpus_begin(void) 1387 + void arch_thaw_secondary_cpus_begin(void) 1388 1388 { 1389 1389 set_mtrr_aps_delayed_init(); 1390 1390 } 1391 1391 1392 - void arch_enable_nonboot_cpus_end(void) 1392 + void arch_thaw_secondary_cpus_end(void) 1393 1393 { 1394 1394 mtrr_aps_init(); 1395 1395 }
+1 -1
arch/x86/power/cpu.c
··· 307 307 if (ret) 308 308 return ret; 309 309 smp_ops.play_dead = resume_play_dead; 310 - ret = disable_nonboot_cpus(); 310 + ret = freeze_secondary_cpus(0); 311 311 smp_ops.play_dead = play_dead; 312 312 return ret; 313 313 }
+4 -15
include/linux/cpu.h
··· 144 144 static inline void put_online_cpus(void) { cpus_read_unlock(); } 145 145 146 146 #ifdef CONFIG_PM_SLEEP_SMP 147 - int __freeze_secondary_cpus(int primary, bool suspend); 148 - static inline int freeze_secondary_cpus(int primary) 149 - { 150 - return __freeze_secondary_cpus(primary, true); 151 - } 152 - 153 - static inline int disable_nonboot_cpus(void) 154 - { 155 - return __freeze_secondary_cpus(0, false); 156 - } 157 - 158 - void enable_nonboot_cpus(void); 147 + extern int freeze_secondary_cpus(int primary); 148 + extern void thaw_secondary_cpus(void); 159 149 160 150 static inline int suspend_disable_secondary_cpus(void) 161 151 { ··· 158 168 } 159 169 static inline void suspend_enable_secondary_cpus(void) 160 170 { 161 - return enable_nonboot_cpus(); 171 + return thaw_secondary_cpus(); 162 172 } 163 173 164 174 #else /* !CONFIG_PM_SLEEP_SMP */ 165 - static inline int disable_nonboot_cpus(void) { return 0; } 166 - static inline void enable_nonboot_cpus(void) {} 175 + static inline void thaw_secondary_cpus(void) {} 167 176 static inline int suspend_disable_secondary_cpus(void) { return 0; } 168 177 static inline void suspend_enable_secondary_cpus(void) { } 169 178 #endif /* !CONFIG_PM_SLEEP_SMP */
+2 -2
include/linux/smp.h
··· 227 227 */ 228 228 extern void arch_disable_smp_support(void); 229 229 230 - extern void arch_enable_nonboot_cpus_begin(void); 231 - extern void arch_enable_nonboot_cpus_end(void); 230 + extern void arch_thaw_secondary_cpus_begin(void); 231 + extern void arch_thaw_secondary_cpus_end(void); 232 232 233 233 void smp_setup_processor_id(void); 234 234
+10 -10
kernel/cpu.c
··· 432 432 /* 433 433 * On x86 it's required to boot all logical CPUs at least once so 434 434 * that the init code can get a chance to set CR4.MCE on each 435 - * CPU. Otherwise, a broadacasted MCE observing CR4.MCE=0b on any 435 + * CPU. Otherwise, a broadcasted MCE observing CR4.MCE=0b on any 436 436 * core will shutdown the machine. 437 437 */ 438 438 return !cpumask_test_cpu(cpu, &cpus_booted_once_mask); ··· 1327 1327 #ifdef CONFIG_PM_SLEEP_SMP 1328 1328 static cpumask_var_t frozen_cpus; 1329 1329 1330 - int __freeze_secondary_cpus(int primary, bool suspend) 1330 + int freeze_secondary_cpus(int primary) 1331 1331 { 1332 1332 int cpu, error = 0; 1333 1333 ··· 1352 1352 if (cpu == primary) 1353 1353 continue; 1354 1354 1355 - if (suspend && pm_wakeup_pending()) { 1355 + if (pm_wakeup_pending()) { 1356 1356 pr_info("Wakeup pending. Abort CPU freeze\n"); 1357 1357 error = -EBUSY; 1358 1358 break; ··· 1376 1376 1377 1377 /* 1378 1378 * Make sure the CPUs won't be enabled by someone else. We need to do 1379 - * this even in case of failure as all disable_nonboot_cpus() users are 1380 - * supposed to do enable_nonboot_cpus() on the failure path. 1379 + * this even in case of failure as all freeze_secondary_cpus() users are 1380 + * supposed to do thaw_secondary_cpus() on the failure path. 1381 1381 */ 1382 1382 cpu_hotplug_disabled++; 1383 1383 ··· 1385 1385 return error; 1386 1386 } 1387 1387 1388 - void __weak arch_enable_nonboot_cpus_begin(void) 1388 + void __weak arch_thaw_secondary_cpus_begin(void) 1389 1389 { 1390 1390 } 1391 1391 1392 - void __weak arch_enable_nonboot_cpus_end(void) 1392 + void __weak arch_thaw_secondary_cpus_end(void) 1393 1393 { 1394 1394 } 1395 1395 1396 - void enable_nonboot_cpus(void) 1396 + void thaw_secondary_cpus(void) 1397 1397 { 1398 1398 int cpu, error; 1399 1399 ··· 1405 1405 1406 1406 pr_info("Enabling non-boot CPUs ...\n"); 1407 1407 1408 - arch_enable_nonboot_cpus_begin(); 1408 + arch_thaw_secondary_cpus_begin(); 1409 1409 1410 1410 for_each_cpu(cpu, frozen_cpus) { 1411 1411 trace_suspend_resume(TPS("CPU_ON"), cpu, true); ··· 1418 1418 pr_warn("Error taking CPU%d up: %d\n", cpu, error); 1419 1419 } 1420 1420 1421 - arch_enable_nonboot_cpus_end(); 1421 + arch_thaw_secondary_cpus_end(); 1422 1422 1423 1423 cpumask_clear(frozen_cpus); 1424 1424 out:
+1 -1
kernel/smp.c
··· 620 620 * early_boot_irqs_disabled is set. Use local_irq_save/restore() instead 621 621 * of local_irq_disable/enable(). 622 622 */ 623 - void on_each_cpu(void (*func) (void *info), void *info, int wait) 623 + void on_each_cpu(smp_call_func_t func, void *info, int wait) 624 624 { 625 625 unsigned long flags; 626 626
+1 -1
tools/power/pm-graph/config/custom-timeline-functions.cfg
··· 125 125 suspend_console: 126 126 acpi_pm_prepare: 127 127 syscore_suspend: 128 - arch_enable_nonboot_cpus_end: 128 + arch_thaw_secondary_cpus_end: 129 129 syscore_resume: 130 130 acpi_pm_finish: 131 131 resume_console:
+1 -1
tools/power/pm-graph/sleepgraph.py
··· 198 198 'suspend_console': {}, 199 199 'acpi_pm_prepare': {}, 200 200 'syscore_suspend': {}, 201 - 'arch_enable_nonboot_cpus_end': {}, 201 + 'arch_thaw_secondary_cpus_end': {}, 202 202 'syscore_resume': {}, 203 203 'acpi_pm_finish': {}, 204 204 'resume_console': {},