Skip to content

Commit d861f6e

Browse files
committed
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()
2 parents 58ff3b7 + fb7fb84 commit d861f6e

File tree

9 files changed

+25
-36
lines changed

9 files changed

+25
-36
lines changed

Documentation/power/suspend-and-cpuhotplug.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ More details follow::
4848
|
4949
|
5050
v
51-
disable_nonboot_cpus()
51+
freeze_secondary_cpus()
5252
/* start */
5353
|
5454
v
@@ -83,7 +83,7 @@ More details follow::
8383
Release cpu_add_remove_lock
8484
|
8585
v
86-
/* disable_nonboot_cpus() complete */
86+
/* freeze_secondary_cpus() complete */
8787
|
8888
v
8989
Do suspend
@@ -93,7 +93,7 @@ More details follow::
9393
Resuming back is likewise, with the counterparts being (in the order of
9494
execution during resume):
9595

96-
* enable_nonboot_cpus() which involves::
96+
* thaw_secondary_cpus() which involves::
9797

9898
| Acquire cpu_add_remove_lock
9999
| Decrease cpu_hotplug_disabled, thereby enabling regular cpu hotplug

arch/x86/kernel/smpboot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,12 +1384,12 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
13841384
speculative_store_bypass_ht_init();
13851385
}
13861386

1387-
void arch_enable_nonboot_cpus_begin(void)
1387+
void arch_thaw_secondary_cpus_begin(void)
13881388
{
13891389
set_mtrr_aps_delayed_init();
13901390
}
13911391

1392-
void arch_enable_nonboot_cpus_end(void)
1392+
void arch_thaw_secondary_cpus_end(void)
13931393
{
13941394
mtrr_aps_init();
13951395
}

arch/x86/power/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ int hibernate_resume_nonboot_cpu_disable(void)
307307
if (ret)
308308
return ret;
309309
smp_ops.play_dead = resume_play_dead;
310-
ret = disable_nonboot_cpus();
310+
ret = freeze_secondary_cpus(0);
311311
smp_ops.play_dead = play_dead;
312312
return ret;
313313
}

include/linux/cpu.h

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,8 @@ static inline void get_online_cpus(void) { cpus_read_lock(); }
144144
static inline void put_online_cpus(void) { cpus_read_unlock(); }
145145

146146
#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);
159149

160150
static inline int suspend_disable_secondary_cpus(void)
161151
{
@@ -168,12 +158,11 @@ static inline int suspend_disable_secondary_cpus(void)
168158
}
169159
static inline void suspend_enable_secondary_cpus(void)
170160
{
171-
return enable_nonboot_cpus();
161+
return thaw_secondary_cpus();
172162
}
173163

174164
#else /* !CONFIG_PM_SLEEP_SMP */
175-
static inline int disable_nonboot_cpus(void) { return 0; }
176-
static inline void enable_nonboot_cpus(void) {}
165+
static inline void thaw_secondary_cpus(void) {}
177166
static inline int suspend_disable_secondary_cpus(void) { return 0; }
178167
static inline void suspend_enable_secondary_cpus(void) { }
179168
#endif /* !CONFIG_PM_SLEEP_SMP */

include/linux/smp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ static inline int get_boot_cpu_id(void)
227227
*/
228228
extern void arch_disable_smp_support(void);
229229

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);
232232

233233
void smp_setup_processor_id(void);
234234

kernel/cpu.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ static inline bool cpu_smt_allowed(unsigned int cpu)
432432
/*
433433
* On x86 it's required to boot all logical CPUs at least once so
434434
* 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
436436
* core will shutdown the machine.
437437
*/
438438
return !cpumask_test_cpu(cpu, &cpus_booted_once_mask);
@@ -1327,7 +1327,7 @@ void bringup_nonboot_cpus(unsigned int setup_max_cpus)
13271327
#ifdef CONFIG_PM_SLEEP_SMP
13281328
static cpumask_var_t frozen_cpus;
13291329

1330-
int __freeze_secondary_cpus(int primary, bool suspend)
1330+
int freeze_secondary_cpus(int primary)
13311331
{
13321332
int cpu, error = 0;
13331333

@@ -1352,7 +1352,7 @@ int __freeze_secondary_cpus(int primary, bool suspend)
13521352
if (cpu == primary)
13531353
continue;
13541354

1355-
if (suspend && pm_wakeup_pending()) {
1355+
if (pm_wakeup_pending()) {
13561356
pr_info("Wakeup pending. Abort CPU freeze\n");
13571357
error = -EBUSY;
13581358
break;
@@ -1376,24 +1376,24 @@ int __freeze_secondary_cpus(int primary, bool suspend)
13761376

13771377
/*
13781378
* 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.
13811381
*/
13821382
cpu_hotplug_disabled++;
13831383

13841384
cpu_maps_update_done();
13851385
return error;
13861386
}
13871387

1388-
void __weak arch_enable_nonboot_cpus_begin(void)
1388+
void __weak arch_thaw_secondary_cpus_begin(void)
13891389
{
13901390
}
13911391

1392-
void __weak arch_enable_nonboot_cpus_end(void)
1392+
void __weak arch_thaw_secondary_cpus_end(void)
13931393
{
13941394
}
13951395

1396-
void enable_nonboot_cpus(void)
1396+
void thaw_secondary_cpus(void)
13971397
{
13981398
int cpu, error;
13991399

@@ -1405,7 +1405,7 @@ void enable_nonboot_cpus(void)
14051405

14061406
pr_info("Enabling non-boot CPUs ...\n");
14071407

1408-
arch_enable_nonboot_cpus_begin();
1408+
arch_thaw_secondary_cpus_begin();
14091409

14101410
for_each_cpu(cpu, frozen_cpus) {
14111411
trace_suspend_resume(TPS("CPU_ON"), cpu, true);
@@ -1418,7 +1418,7 @@ void enable_nonboot_cpus(void)
14181418
pr_warn("Error taking CPU%d up: %d\n", cpu, error);
14191419
}
14201420

1421-
arch_enable_nonboot_cpus_end();
1421+
arch_thaw_secondary_cpus_end();
14221422

14231423
cpumask_clear(frozen_cpus);
14241424
out:

kernel/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ void __init smp_init(void)
620620
* early_boot_irqs_disabled is set. Use local_irq_save/restore() instead
621621
* of local_irq_disable/enable().
622622
*/
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)
624624
{
625625
unsigned long flags;
626626

tools/power/pm-graph/config/custom-timeline-functions.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ acpi_suspend_begin:
125125
suspend_console:
126126
acpi_pm_prepare:
127127
syscore_suspend:
128-
arch_enable_nonboot_cpus_end:
128+
arch_thaw_secondary_cpus_end:
129129
syscore_resume:
130130
acpi_pm_finish:
131131
resume_console:

tools/power/pm-graph/sleepgraph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class SystemValues:
198198
'suspend_console': {},
199199
'acpi_pm_prepare': {},
200200
'syscore_suspend': {},
201-
'arch_enable_nonboot_cpus_end': {},
201+
'arch_thaw_secondary_cpus_end': {},
202202
'syscore_resume': {},
203203
'acpi_pm_finish': {},
204204
'resume_console': {},

0 commit comments

Comments
 (0)