Exemple #1
0
static int __cpuinit
do_boot_cpu (int sapicid, int cpu, struct task_struct *idle)
{
	int timeout;

	task_for_booting_cpu = idle;
	Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);

	set_brendez_area(cpu);
	platform_send_ipi(cpu, ap_wakeup_vector, IA64_IPI_DM_INT, 0);

	/*
	 * Wait 10s total for the AP to start
	 */
	Dprintk("Waiting on callin_map ...");
	for (timeout = 0; timeout < 100000; timeout++) {
		if (cpu_isset(cpu, cpu_callin_map))
			break;  /* It has booted */
		udelay(100);
	}
	Dprintk("\n");

	if (!cpu_isset(cpu, cpu_callin_map)) {
		printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid);
		ia64_cpu_to_sapicid[cpu] = -1;
		set_cpu_online(cpu, false);  /* was set in smp_callin() */
		return -EINVAL;
	}
	return 0;
}
static int __devinit
do_boot_cpu (int sapicid, int cpu)
{
    int timeout;
    struct create_idle c_idle = {
        .cpu	= cpu,
        .done	= COMPLETION_INITIALIZER(c_idle.done),
    };
    DECLARE_WORK(work, do_fork_idle, &c_idle);

    c_idle.idle = get_idle_for_cpu(cpu);
    if (c_idle.idle) {
        init_idle(c_idle.idle, cpu);
        goto do_rest;
    }

    /*
     * We can't use kernel_thread since we must avoid to reschedule the child.
     */
    if (!keventd_up() || current_is_keventd())
        work.func(work.data);
    else {
        schedule_work(&work);
        wait_for_completion(&c_idle.done);
    }

    if (IS_ERR(c_idle.idle))
        panic("failed fork for CPU %d", cpu);

    set_idle_for_cpu(cpu, c_idle.idle);

do_rest:
    task_for_booting_cpu = c_idle.idle;

    Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);

    set_brendez_area(cpu);
    platform_send_ipi(cpu, ap_wakeup_vector, IA64_IPI_DM_INT, 0);

    /*
     * Wait 10s total for the AP to start
     */
    Dprintk("Waiting on callin_map ...");
    for (timeout = 0; timeout < 100000; timeout++) {
        if (cpu_isset(cpu, cpu_callin_map))
            break;  /* It has booted */
        udelay(100);
    }
    Dprintk("\n");

    if (!cpu_isset(cpu, cpu_callin_map)) {
        printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid);
        ia64_cpu_to_sapicid[cpu] = -1;
        cpu_clear(cpu, cpu_online_map);  /* was set in smp_callin() */
        return -EINVAL;
    }
    return 0;
}

static int __init
decay (char *str)
{
    int ticks;
    get_option (&str, &ticks);
    return 1;
}