Re: CPU hotplug on i386

From: Nathan Lynch
Date: Wed Mar 16 2005 - 13:59:25 EST


Hi again-

On Wed, Mar 16, 2005 at 02:21:52PM +0100, Pavel Machek wrote:
> + int cpu, error;
> + cpus_clear(frozen_cpus);
> + printk("Freezing cpus...\n");
> + for_each_online_cpu(cpu) {
> + if (!cpu)
> + continue;
> + cpu_set(cpu, frozen_cpus);
> + error = cpu_down(cpu);
> + if (!error)
> + continue;
> + printk("Error taking cpu %d down: %d\n", cpu, error);
> + panic("Too many cpus");
> }
> - printk("ok\n");
> + BUG_ON(smp_processor_id() != 0);
> }
>
> void enable_nonboot_cpus(void)
> {
> - printk("Restarting CPUs");
> - atomic_set(&freeze, 0);
> - while (atomic_read(&cpu_counter)) {
> - cpu_relax();
> - barrier();
> + int cpu, error;
> + printk("Thawing cpus...\n");
> + for_each_cpu_mask(cpu, frozen_cpus) {
> + if (!cpu)
> + continue;
> + error = cpu_up(cpu);
> + if (!error)
> + continue;
> + printk("Error taking cpu %d up: %d\n", cpu, error);
> + panic("Not enough cpus");
> }

If you're going to depend on CONFIG_HOTPLUG_CPU for swsusp on smp, why
not offline the non-boot cpus from userspace? Same goes for onlining
additional cpus during resume.

Nathan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/