History

cpu/hotplug: Provide bringup_hibernate_cpu()

arm64 uses cpu_up() in the resume from hibernation code to ensure that the CPU on which the system hibernated is online. Provide a core function for this. [ tglx: Split out from the combo arm64 patch ]

Qais Yousef committed 6 years ago

Commit d720f981 parent 5efbe6a2 files · +24 −0Browse files

Unified · Split

2 files
  1. include/linux/cpu.h +1 −0
  2. kernel/cpu.c +23 −0
include/linux/cpu.h+1−0
@@ -93,6 +93,7 @@ int add_cpu(unsigned int cpu); · 92 unmodified lines
9393 void notify_cpu_starting(unsigned int cpu);
9494 extern void cpu_maps_update_begin(void);
9595 extern void cpu_maps_update_done(void);
96+int bringup_hibernate_cpu(unsigned int sleep_cpu);
9697
9798 #else /* CONFIG_SMP */
9899 #define cpuhp_tasks_frozen 0
kernel/cpu.c+23−0
@@ -1275,6 +1275,29 @@ int add_cpu(unsigned int cpu) · 1274 unmodified lines
12751275 }
12761276 EXPORT_SYMBOL_GPL(add_cpu);
12771277
1278+/**
1279+ * bringup_hibernate_cpu - Bring up the CPU that we hibernated on
1280+ * @sleep_cpu: The cpu we hibernated on and should be brought up.
1281+ *
1282+ * On some architectures like arm64, we can hibernate on any CPU, but on
1283+ * wake up the CPU we hibernated on might be offline as a side effect of
1284+ * using maxcpus= for example.
1285+ */
1286+int bringup_hibernate_cpu(unsigned int sleep_cpu)
1287+{
1288+ int ret;
1289+
1290+ if (!cpu_online(sleep_cpu)) {
1291+ pr_info("Hibernated on a CPU that is offline! Bringing CPU up.\n");
1292+ ret = cpu_up(sleep_cpu);
1293+ if (ret) {
1294+ pr_err("Failed to bring hibernate-CPU up!\n");
1295+ return ret;
1296+ }
1297+ }
1298+ return 0;
1299+}
1300+
12781301 #ifdef CONFIG_PM_SLEEP_SMP
12791302 static cpumask_var_t frozen_cpus;
12801303

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t