s390/smp: consolidate locking for smp_rescan()
Move locking to __smp_rescan() instead of duplicating it to all call sites. Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
4c86d2f51a
commit
588a079ebd
|
@ -780,6 +780,8 @@ static int __smp_rescan_cpus(struct sclp_core_info *info, bool early)
|
||||||
u16 core_id;
|
u16 core_id;
|
||||||
int nr, i;
|
int nr, i;
|
||||||
|
|
||||||
|
get_online_cpus();
|
||||||
|
mutex_lock(&smp_cpu_state_mutex);
|
||||||
nr = 0;
|
nr = 0;
|
||||||
cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask);
|
cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask);
|
||||||
/*
|
/*
|
||||||
|
@ -800,6 +802,8 @@ static int __smp_rescan_cpus(struct sclp_core_info *info, bool early)
|
||||||
configured = i < info->configured;
|
configured = i < info->configured;
|
||||||
nr += smp_add_core(&info->core[i], &avail, configured, early);
|
nr += smp_add_core(&info->core[i], &avail, configured, early);
|
||||||
}
|
}
|
||||||
|
mutex_unlock(&smp_cpu_state_mutex);
|
||||||
|
put_online_cpus();
|
||||||
return nr;
|
return nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,9 +851,7 @@ void __init smp_detect_cpus(void)
|
||||||
pr_info("%d configured CPUs, %d standby CPUs\n", c_cpus, s_cpus);
|
pr_info("%d configured CPUs, %d standby CPUs\n", c_cpus, s_cpus);
|
||||||
|
|
||||||
/* Add CPUs present at boot */
|
/* Add CPUs present at boot */
|
||||||
get_online_cpus();
|
|
||||||
__smp_rescan_cpus(info, true);
|
__smp_rescan_cpus(info, true);
|
||||||
put_online_cpus();
|
|
||||||
memblock_free_early((unsigned long)info, sizeof(*info));
|
memblock_free_early((unsigned long)info, sizeof(*info));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,11 +1180,7 @@ int __ref smp_rescan_cpus(void)
|
||||||
if (!info)
|
if (!info)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
smp_get_core_info(info, 0);
|
smp_get_core_info(info, 0);
|
||||||
get_online_cpus();
|
|
||||||
mutex_lock(&smp_cpu_state_mutex);
|
|
||||||
nr = __smp_rescan_cpus(info, false);
|
nr = __smp_rescan_cpus(info, false);
|
||||||
mutex_unlock(&smp_cpu_state_mutex);
|
|
||||||
put_online_cpus();
|
|
||||||
kfree(info);
|
kfree(info);
|
||||||
if (nr)
|
if (nr)
|
||||||
topology_schedule_update();
|
topology_schedule_update();
|
||||||
|
|
Loading…
Reference in New Issue