示例#1
0
void __ref enable_nonboot_cpus(void)
{
	int cpu, error;

	/* Allow everyone to use the CPU hotplug again */
	cpu_maps_update_begin();
	cpu_hotplug_disabled = 0;
	if (cpumask_empty(frozen_cpus))
		goto out;

#ifdef CONFIG_DEBUG_PRINTK
	printk(KERN_INFO "Enabling non-boot CPUs ...\n");
#else
	;
#endif

	arch_enable_nonboot_cpus_begin();

	for_each_cpu(cpu, frozen_cpus) {
		error = _cpu_up(cpu, 1);
		if (!error) {
#ifdef CONFIG_DEBUG_PRINTK
			printk(KERN_INFO "CPU%d is up\n", cpu);
#else
			;
#endif
			continue;
		}
#ifdef CONFIG_DEBUG_PRINTK
		printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
#else
		;
#endif
	}
示例#2
0
文件: cpu.c 项目: borkmann/kasan
int cpu_up(unsigned int cpu)
{
	int err = 0;

	if (!cpu_possible(cpu)) {
		pr_err("can't online cpu %d because it is not configured as may-hotadd at boot time\n",
		       cpu);
#if defined(CONFIG_IA64)
		pr_err("please check additional_cpus= boot parameter\n");
#endif
		return -EINVAL;
	}

	err = try_online_node(cpu_to_node(cpu));
	if (err)
		return err;

	cpu_maps_update_begin();

	if (cpu_hotplug_disabled) {
		err = -EBUSY;
		goto out;
	}

	err = _cpu_up(cpu, 0);

out:
	cpu_maps_update_done();
	return err;
}
示例#3
0
void __ref enable_nonboot_cpus(void)
{
	int cpu, error;
	struct device *cpu_device;

	/* Allow everyone to use the CPU hotplug again */
	cpu_maps_update_begin();
	cpu_hotplug_disabled = 0;
	if (cpumask_empty(frozen_cpus))
		goto out;

	pr_debug("Enabling non-boot CPUs ...\n");

	arch_enable_nonboot_cpus_begin();

	for_each_cpu(cpu, frozen_cpus) {
		error = _cpu_up(cpu, 1);
		if (!error) {
			pr_debug(KERN_INFO "CPU%d is up\n", cpu);
			cpu_device = get_cpu_device(cpu);
			if (!cpu_device)
				pr_err("%s: failed to get cpu%d device\n",
				       __func__, cpu);
			else
				kobject_uevent(&cpu_device->kobj, KOBJ_ONLINE);
			continue;
		}
		printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
	}
示例#4
0
void __ref enable_nonboot_cpus(void)
{
    int cpu, error;

    /* Allow everyone to use the CPU hotplug again */
    cpu_maps_update_begin();
    cpu_hotplug_disabled = 0;
    if (cpumask_empty(frozen_cpus))
        goto out;

    printk(KERN_INFO "Enabling non-boot CPUs ...\n");

    arch_enable_nonboot_cpus_begin();

#if defined(CONFIG_SCHED_HMP) && defined(CONFIG_EXYNOS5_DYNAMIC_CPU_HOTPLUG)
    if (!disable_dm_hotplug_before_suspend)
        cpumask_and(frozen_cpus, frozen_cpus, &hmp_slow_cpu_mask);
#endif

    for_each_cpu(cpu, frozen_cpus) {
        error = _cpu_up(cpu, 1);
        if (!error) {
            printk(KERN_INFO "CPU%d is up\n", cpu);
            continue;
        }
        printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
    }
示例#5
0
int __cpuinit cpu_up(unsigned int cpu)
{
	int err = 0;

	if(cpu_online(cpu))
	{
		printk(KERN_INFO "[Stability] CPU_%d has already on \n",cpu);
		return err;
	}

#ifdef	CONFIG_MEMORY_HOTPLUG
	int nid;
	pg_data_t	*pgdat;
#endif

	if (!cpu_possible(cpu)) {
		printk(KERN_ERR "can't online cpu %d because it is not "
			"configured as may-hotadd at boot time\n", cpu);
#if defined(CONFIG_IA64)
		printk(KERN_ERR "please check additional_cpus= boot "
				"parameter\n");
#endif
		return -EINVAL;
	}

#ifdef	CONFIG_MEMORY_HOTPLUG
	nid = cpu_to_node(cpu);
	if (!node_online(nid)) {
		err = mem_online_node(nid);
		if (err)
			return err;
	}

	pgdat = NODE_DATA(nid);
	if (!pgdat) {
		printk(KERN_ERR
			"Can't online cpu %d due to NULL pgdat\n", cpu);
		return -ENOMEM;
	}

	if (pgdat->node_zonelists->_zonerefs->zone == NULL) {
		mutex_lock(&zonelists_mutex);
		build_all_zonelists(NULL);
		mutex_unlock(&zonelists_mutex);
	}
#endif

	cpu_maps_update_begin();

	if (cpu_hotplug_disabled) {
		err = -EBUSY;
		goto out;
	}

	err = _cpu_up(cpu, 0);

out:
	cpu_maps_update_done();
	return err;
}
示例#6
0
文件: cpu.c 项目: borkmann/kasan
void __ref enable_nonboot_cpus(void)
{
	int cpu, error;

	/* Allow everyone to use the CPU hotplug again */
	cpu_maps_update_begin();
	cpu_hotplug_disabled = 0;
	if (cpumask_empty(frozen_cpus))
		goto out;

	pr_info("Enabling non-boot CPUs ...\n");

	arch_enable_nonboot_cpus_begin();

	for_each_cpu(cpu, frozen_cpus) {
		error = _cpu_up(cpu, 1);
		if (!error) {
			pr_info("CPU%d is up\n", cpu);
			continue;
		}
		pr_warn("Error taking CPU%d up: %d\n", cpu, error);
	}
示例#7
0
void __ref enable_nonboot_cpus(void)
{
	int cpu, error;

	
	cpu_maps_update_begin();
	cpu_hotplug_disabled = 0;
	if (cpumask_empty(frozen_cpus))
		goto out;

	printk(KERN_INFO "Enabling non-boot CPUs ...\n");

	arch_enable_nonboot_cpus_begin();

	for_each_cpu(cpu, frozen_cpus) {
		error = _cpu_up(cpu, 1);
		if (!error) {
			printk(KERN_INFO "CPU%d is up\n", cpu);
			continue;
		}
		printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
	}
示例#8
0
void __ref enable_nonboot_cpus(void)
{
	int cpu, error;
#if defined (CONFIG_MACH_APQ8064_OMEGA) || defined (CONFIG_MACH_APQ8064_OMEGAR)
	static int first = 0;

	if (!first) {
		init_timer(&boost_freq_timer);
		first = 1;
	}
	if (timer_pending(&boost_freq_timer))
		del_timer(&boost_freq_timer);
	boost_freq_timer.function = boost_freq_timer_cb;
	boost_freq_timer.expires =
		jiffies + msecs_to_jiffies(BOOST_FREQ_TIME_MS);
	add_timer(&boost_freq_timer);
	boost_freq = 1;
#endif

	/* Allow everyone to use the CPU hotplug again */
	cpu_maps_update_begin();
	cpu_hotplug_disabled = 0;
	if (cpumask_empty(frozen_cpus))
		goto out;

	printk(KERN_INFO "Enabling non-boot CPUs ...\n");

	arch_enable_nonboot_cpus_begin();

	for_each_cpu(cpu, frozen_cpus) {
		error = _cpu_up(cpu, 1);
		if (!error) {
			printk(KERN_INFO "CPU%d is up\n", cpu);
			continue;
		}
		printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
	}
示例#9
0
文件: cpu.c 项目: andy-shev/linux
void enable_nonboot_cpus(void)
{
	int cpu, error;

	/* Allow everyone to use the CPU hotplug again */
	cpu_maps_update_begin();
	WARN_ON(--cpu_hotplug_disabled < 0);
	if (cpumask_empty(frozen_cpus))
		goto out;

	pr_info("Enabling non-boot CPUs ...\n");

	arch_enable_nonboot_cpus_begin();

	for_each_cpu(cpu, frozen_cpus) {
		trace_suspend_resume(TPS("CPU_ON"), cpu, true);
		error = _cpu_up(cpu, 1);
		trace_suspend_resume(TPS("CPU_ON"), cpu, false);
		if (!error) {
			pr_info("CPU%d is up\n", cpu);
			continue;
		}
		pr_warn("Error taking CPU%d up: %d\n", cpu, error);
	}
示例#10
0
int __cpuinit cpu_up(unsigned int cpu)
{
	int err = 0;

#ifdef	CONFIG_MEMORY_HOTPLUG
	int nid;
	pg_data_t	*pgdat;
#endif

	if (!cpu_possible(cpu)) {
		printk(KERN_ERR "can't online cpu %d because it is not "
			"configured as may-hotadd at boot time\n", cpu);
#if defined(CONFIG_IA64)
		printk(KERN_ERR "please check additional_cpus= boot "
				"parameter\n");
#endif
		return -EINVAL;
	}

#ifdef	CONFIG_MEMORY_HOTPLUG
	nid = cpu_to_node(cpu);
	if (!node_online(nid)) {
		err = mem_online_node(nid);
		if (err)
			return err;
	}

	pgdat = NODE_DATA(nid);
	if (!pgdat) {
		printk(KERN_ERR
			"Can't online cpu %d due to NULL pgdat\n", cpu);
		return -ENOMEM;
	}

	if (pgdat->node_zonelists->_zonerefs->zone == NULL) {
		mutex_lock(&zonelists_mutex);
		build_all_zonelists(NULL);
		mutex_unlock(&zonelists_mutex);
	}
#endif

	cpu_maps_update_begin();

#ifdef CONFIG_CPU_FREQ_GOV_K3HOTPLUG
	if ((gcpu_num_limit.block != 0)
		&& (num_online_cpus() >= gcpu_num_limit.block)) {
		pr_err("[%s]cpu lock is %d can not hotplug cpu.\n",
			__func__, gcpu_num_limit.block);
		err = -EPERM;
		goto out;
	} else if ((gcpu_num_limit.block == 0)
				&& (num_online_cpus() >= gcpu_num_limit.max)) {
		pr_err("[%s]cpu max is %d can not hotplug cpu.\n",
			__func__, gcpu_num_limit.max);
		err = -EPERM;
		goto out;
	}

	if (cpu != (num_online_cpus())) {
		err = -EPERM;
		goto out;
	}
#endif

	if (cpu_hotplug_disabled) {
		err = -EBUSY;
		goto out;
	}

	err = _cpu_up(cpu, 0);

out:
	cpu_maps_update_done();
	return err;
}