Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23606
b: refs/heads/master
c: 34f361a
h: refs/heads/master
v: v3
  • Loading branch information
Ashok Raj authored and Linus Torvalds committed Mar 25, 2006
1 parent cf887ba commit 638b9e0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f1a1c2dc2a956c375b432d2a9a28e52ba9d81c7c
refs/heads/master: 34f361ade2fb4a869f6a7714d01c04ce4cfa75d9
33 changes: 18 additions & 15 deletions trunk/arch/i386/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,6 @@ void cpu_exit_clear(void)

cpu_clear(cpu, cpu_callout_map);
cpu_clear(cpu, cpu_callin_map);
cpu_clear(cpu, cpu_present_map);

cpu_clear(cpu, smp_commenced_mask);
unmap_cpu_to_logical_apicid(cpu);
Expand All @@ -1015,31 +1014,20 @@ struct warm_boot_cpu_info {
int cpu;
};

static void __devinit do_warm_boot_cpu(void *p)
static void __cpuinit do_warm_boot_cpu(void *p)
{
struct warm_boot_cpu_info *info = p;
do_boot_cpu(info->apicid, info->cpu);
complete(info->complete);
}

int __devinit smp_prepare_cpu(int cpu)
static int __cpuinit __smp_prepare_cpu(int cpu)
{
DECLARE_COMPLETION(done);
struct warm_boot_cpu_info info;
struct work_struct task;
int apicid, ret;

lock_cpu_hotplug();

/*
* On x86, CPU0 is never offlined. Trying to bring up an
* already-booted CPU will hang. So check for that case.
*/
if (cpu_online(cpu)) {
ret = -EINVAL;
goto exit;
}

apicid = x86_cpu_to_apicid[cpu];
if (apicid == BAD_APICID) {
ret = -ENODEV;
Expand All @@ -1064,7 +1052,6 @@ int __devinit smp_prepare_cpu(int cpu)
zap_low_mappings();
ret = 0;
exit:
unlock_cpu_hotplug();
return ret;
}
#endif
Expand Down Expand Up @@ -1392,6 +1379,22 @@ void __cpu_die(unsigned int cpu)

int __devinit __cpu_up(unsigned int cpu)
{
#ifdef CONFIG_HOTPLUG_CPU
int ret=0;

/*
* We do warm boot only on cpus that had booted earlier
* Otherwise cold boot is all handled from smp_boot_cpus().
* cpu_callin_map is set during AP kickstart process. Its reset
* when a cpu is taken offline from cpu_exit_clear().
*/
if (!cpu_isset(cpu, cpu_callin_map))
ret = __smp_prepare_cpu(cpu);

if (ret)
return -EIO;
#endif

/* In case one didn't come up */
if (!cpu_isset(cpu, cpu_callin_map)) {
printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu);
Expand Down
9 changes: 1 addition & 8 deletions trunk/drivers/base/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ EXPORT_SYMBOL(cpu_sysdev_class);
static struct sys_device *cpu_sys_devices[NR_CPUS];

#ifdef CONFIG_HOTPLUG_CPU
int __attribute__((weak)) smp_prepare_cpu (int cpu)
{
return 0;
}

static ssize_t show_online(struct sys_device *dev, char *buf)
{
struct cpu *cpu = container_of(dev, struct cpu, sysdev);
Expand All @@ -44,9 +39,7 @@ static ssize_t store_online(struct sys_device *dev, const char *buf,
kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
break;
case '1':
ret = smp_prepare_cpu(cpu->sysdev.id);
if (!ret)
ret = cpu_up(cpu->sysdev.id);
ret = cpu_up(cpu->sysdev.id);
if (!ret)
kobject_uevent(&dev->kobj, KOBJ_ONLINE);
break;
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ extern int lock_cpu_hotplug_interruptible(void);
register_cpu_notifier(&fn##_nb); \
}
int cpu_down(unsigned int cpu);
extern int __attribute__((weak)) smp_prepare_cpu(int cpu);
#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
#else
#define lock_cpu_hotplug() do { } while (0)
Expand Down
4 changes: 1 addition & 3 deletions trunk/kernel/power/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ void enable_nonboot_cpus(void)

printk("Thawing cpus ...\n");
for_each_cpu_mask(cpu, frozen_cpus) {
error = smp_prepare_cpu(cpu);
if (!error)
error = cpu_up(cpu);
error = cpu_up(cpu);
if (!error) {
printk("CPU%d is up\n", cpu);
continue;
Expand Down

0 comments on commit 638b9e0

Please sign in to comment.