smp.c (879f99ef2c4c05d9a7f0a67a05f1415663119825) smp.c (c814ca029e1015bb0ecec312f4bb9751ba1a711a)
1/*
2 * SMP initialisation and IPI support
3 * Based on arch/arm/kernel/smp.c
4 *
5 * Copyright (C) 2012 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 214 unchanged lines hidden (view full) ---

223 /*
224 * Remove this CPU from the vm mask set of all processes.
225 */
226 clear_tasks_mm_cpumask(cpu);
227
228 return 0;
229}
230
1/*
2 * SMP initialisation and IPI support
3 * Based on arch/arm/kernel/smp.c
4 *
5 * Copyright (C) 2012 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 214 unchanged lines hidden (view full) ---

223 /*
224 * Remove this CPU from the vm mask set of all processes.
225 */
226 clear_tasks_mm_cpumask(cpu);
227
228 return 0;
229}
230
231static int op_cpu_kill(unsigned int cpu)
232{
233 /*
234 * If we have no means of synchronising with the dying CPU, then assume
235 * that it is really dead. We can only wait for an arbitrary length of
236 * time and hope that it's dead, so let's skip the wait and just hope.
237 */
238 if (!cpu_ops[cpu]->cpu_kill)
239 return 1;
240
241 return cpu_ops[cpu]->cpu_kill(cpu);
242}
243
231static DECLARE_COMPLETION(cpu_died);
232
233/*
234 * called on the thread which is asking for a CPU to be shutdown -
235 * waits until shutdown has completed, or it is timed out.
236 */
237void __cpu_die(unsigned int cpu)
238{
239 if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
240 pr_crit("CPU%u: cpu didn't die\n", cpu);
241 return;
242 }
243 pr_notice("CPU%u: shutdown\n", cpu);
244static DECLARE_COMPLETION(cpu_died);
245
246/*
247 * called on the thread which is asking for a CPU to be shutdown -
248 * waits until shutdown has completed, or it is timed out.
249 */
250void __cpu_die(unsigned int cpu)
251{
252 if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
253 pr_crit("CPU%u: cpu didn't die\n", cpu);
254 return;
255 }
256 pr_notice("CPU%u: shutdown\n", cpu);
257
258 /*
259 * Now that the dying CPU is beyond the point of no return w.r.t.
260 * in-kernel synchronisation, try to get the firwmare to help us to
261 * verify that it has really left the kernel before we consider
262 * clobbering anything it might still be using.
263 */
264 if (!op_cpu_kill(cpu))
265 pr_warn("CPU%d may not have shut down cleanly\n", cpu);
244}
245
246/*
247 * Called from the idle thread for the CPU which has been shutdown.
248 *
249 * Note that we disable IRQs here, but do not re-enable them
250 * before returning to the caller. This is also the behaviour
251 * of the other hotplug-cpu capable cores, so presumably coming

--- 353 unchanged lines hidden ---
266}
267
268/*
269 * Called from the idle thread for the CPU which has been shutdown.
270 *
271 * Note that we disable IRQs here, but do not re-enable them
272 * before returning to the caller. This is also the behaviour
273 * of the other hotplug-cpu capable cores, so presumably coming

--- 353 unchanged lines hidden ---