|
@@ -57,14 +57,12 @@ void cpu_list_unlock(void)
|
|
qemu_mutex_unlock(&qemu_cpu_list_lock);
|
|
qemu_mutex_unlock(&qemu_cpu_list_lock);
|
|
}
|
|
}
|
|
|
|
|
|
-static bool cpu_index_auto_assigned;
|
|
|
|
|
|
|
|
-static int cpu_get_free_index(void)
|
|
|
|
|
|
+int cpu_get_free_index(void)
|
|
{
|
|
{
|
|
CPUState *some_cpu;
|
|
CPUState *some_cpu;
|
|
int max_cpu_index = 0;
|
|
int max_cpu_index = 0;
|
|
|
|
|
|
- cpu_index_auto_assigned = true;
|
|
|
|
CPU_FOREACH(some_cpu) {
|
|
CPU_FOREACH(some_cpu) {
|
|
if (some_cpu->cpu_index >= max_cpu_index) {
|
|
if (some_cpu->cpu_index >= max_cpu_index) {
|
|
max_cpu_index = some_cpu->cpu_index + 1;
|
|
max_cpu_index = some_cpu->cpu_index + 1;
|
|
@@ -83,8 +81,11 @@ unsigned int cpu_list_generation_id_get(void)
|
|
|
|
|
|
void cpu_list_add(CPUState *cpu)
|
|
void cpu_list_add(CPUState *cpu)
|
|
{
|
|
{
|
|
|
|
+ static bool cpu_index_auto_assigned;
|
|
|
|
+
|
|
QEMU_LOCK_GUARD(&qemu_cpu_list_lock);
|
|
QEMU_LOCK_GUARD(&qemu_cpu_list_lock);
|
|
if (cpu->cpu_index == UNASSIGNED_CPU_INDEX) {
|
|
if (cpu->cpu_index == UNASSIGNED_CPU_INDEX) {
|
|
|
|
+ cpu_index_auto_assigned = true;
|
|
cpu->cpu_index = cpu_get_free_index();
|
|
cpu->cpu_index = cpu_get_free_index();
|
|
assert(cpu->cpu_index != UNASSIGNED_CPU_INDEX);
|
|
assert(cpu->cpu_index != UNASSIGNED_CPU_INDEX);
|
|
} else {
|
|
} else {
|