Skip to content

Commit 5655585

Browse files
Qais YousefKAGA-KOKO
authored andcommitted
cpu/hotplug: Remove disable_nonboot_cpus()
The single user could have called freeze_secondary_cpus() directly. Since this function was a source of confusion, remove it as it's just a pointless wrapper. While at it, rename enable_nonboot_cpus() to thaw_secondary_cpus() to preserve the naming symmetry. Done automatically via: git grep -l enable_nonboot_cpus | xargs sed -i 's/enable_nonboot_cpus/thaw_secondary_cpus/g' Signed-off-by: Qais Yousef <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 182e073 commit 5655585

File tree

8 files changed

+20
-26
lines changed

8 files changed

+20
-26
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
@@ -1376,12 +1376,12 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
13761376
speculative_store_bypass_ht_init();
13771377
}
13781378

1379-
void arch_enable_nonboot_cpus_begin(void)
1379+
void arch_thaw_secondary_cpus_begin(void)
13801380
{
13811381
set_mtrr_aps_delayed_init();
13821382
}
13831383

1384-
void arch_enable_nonboot_cpus_end(void)
1384+
void arch_thaw_secondary_cpus_end(void)
13851385
{
13861386
mtrr_aps_init();
13871387
}

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: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,7 @@ static inline int freeze_secondary_cpus(int primary)
150150
return __freeze_secondary_cpus(primary, true);
151151
}
152152

153-
static inline int disable_nonboot_cpus(void)
154-
{
155-
return __freeze_secondary_cpus(0, false);
156-
}
157-
158-
void enable_nonboot_cpus(void);
153+
extern void thaw_secondary_cpus(void);
159154

160155
static inline int suspend_disable_secondary_cpus(void)
161156
{
@@ -168,12 +163,11 @@ static inline int suspend_disable_secondary_cpus(void)
168163
}
169164
static inline void suspend_enable_secondary_cpus(void)
170165
{
171-
return enable_nonboot_cpus();
166+
return thaw_secondary_cpus();
172167
}
173168

174169
#else /* !CONFIG_PM_SLEEP_SMP */
175-
static inline int disable_nonboot_cpus(void) { return 0; }
176-
static inline void enable_nonboot_cpus(void) {}
170+
static inline void thaw_secondary_cpus(void) {}
177171
static inline int suspend_disable_secondary_cpus(void) { return 0; }
178172
static inline void suspend_enable_secondary_cpus(void) { }
179173
#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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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:

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
@@ -192,7 +192,7 @@ class SystemValues:
192192
'suspend_console': {},
193193
'acpi_pm_prepare': {},
194194
'syscore_suspend': {},
195-
'arch_enable_nonboot_cpus_end': {},
195+
'arch_thaw_secondary_cpus_end': {},
196196
'syscore_resume': {},
197197
'acpi_pm_finish': {},
198198
'resume_console': {},

0 commit comments

Comments
 (0)