mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
34f361ade2
- Moved check for online cpu out of smp_prepare_cpu() - Moved default declaration of smp_prepare_cpu() to kernel/cpu.c - Removed lock_cpu_hotplug() from smp_prepare_cpu() to around it, since its called from cpu_up() as well now. - Removed clearing from cpu_present_map during cpu_offline as it breaks using cpu_up() directly during a subsequent online operation. Signed-off-by: Ashok Raj <ashok.raj@intel.com> Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com> Cc: "Li, Shaohua" <shaohua.li@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
62 lines
1.2 KiB
C
62 lines
1.2 KiB
C
/*
|
|
* drivers/power/smp.c - Functions for stopping other CPUs.
|
|
*
|
|
* Copyright 2004 Pavel Machek <pavel@suse.cz>
|
|
* Copyright (C) 2002-2003 Nigel Cunningham <ncunningham@clear.net.nz>
|
|
*
|
|
* This file is released under the GPLv2.
|
|
*/
|
|
|
|
#undef DEBUG
|
|
|
|
#include <linux/smp_lock.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/suspend.h>
|
|
#include <linux/module.h>
|
|
#include <linux/cpu.h>
|
|
#include <asm/atomic.h>
|
|
#include <asm/tlbflush.h>
|
|
|
|
/* This is protected by pm_sem semaphore */
|
|
static cpumask_t frozen_cpus;
|
|
|
|
void disable_nonboot_cpus(void)
|
|
{
|
|
int cpu, error;
|
|
|
|
error = 0;
|
|
cpus_clear(frozen_cpus);
|
|
printk("Freezing cpus ...\n");
|
|
for_each_online_cpu(cpu) {
|
|
if (cpu == 0)
|
|
continue;
|
|
error = cpu_down(cpu);
|
|
if (!error) {
|
|
cpu_set(cpu, frozen_cpus);
|
|
printk("CPU%d is down\n", cpu);
|
|
continue;
|
|
}
|
|
printk("Error taking cpu %d down: %d\n", cpu, error);
|
|
}
|
|
BUG_ON(raw_smp_processor_id() != 0);
|
|
if (error)
|
|
panic("cpus not sleeping");
|
|
}
|
|
|
|
void enable_nonboot_cpus(void)
|
|
{
|
|
int cpu, error;
|
|
|
|
printk("Thawing cpus ...\n");
|
|
for_each_cpu_mask(cpu, frozen_cpus) {
|
|
error = cpu_up(cpu);
|
|
if (!error) {
|
|
printk("CPU%d is up\n", cpu);
|
|
continue;
|
|
}
|
|
printk("Error taking cpu %d up: %d\n", cpu, error);
|
|
panic("Not enough cpus");
|
|
}
|
|
cpus_clear(frozen_cpus);
|
|
}
|
|
|