From: Eduardo Habkost Date: Mon, 27 Apr 2015 20:00:33 +0000 (-0300) Subject: cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init X-Git-Tag: v2.4.0-rc0~3^2~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=291135b5da228e58900c120e12354cc0a23608e3;p=thirdparty%2Fqemu.git cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init Instead of initializing cpu->as, cpu->thread_id, and reloading memory map while holding cpu_list_lock(), do it earlier, before locking the CPU list and initializing cpu_index. This allows the code handling cpu_index and global CPU list to be isolated from the rest. Cc: Paolo Bonzini Signed-off-by: Eduardo Habkost Signed-off-by: Andreas Färber --- diff --git a/exec.c b/exec.c index e2caee98b6f..442df0dd5bd 100644 --- a/exec.c +++ b/exec.c @@ -533,6 +533,12 @@ void cpu_exec_init(CPUArchState *env) CPUState *some_cpu; int cpu_index; +#ifndef CONFIG_USER_ONLY + cpu->as = &address_space_memory; + cpu->thread_id = qemu_get_thread_id(); + cpu_reload_memory_map(cpu); +#endif + #if defined(CONFIG_USER_ONLY) cpu_list_lock(); #endif @@ -541,11 +547,6 @@ void cpu_exec_init(CPUArchState *env) cpu_index++; } cpu->cpu_index = cpu_index; -#ifndef CONFIG_USER_ONLY - cpu->as = &address_space_memory; - cpu->thread_id = qemu_get_thread_id(); - cpu_reload_memory_map(cpu); -#endif QTAILQ_INSERT_TAIL(&cpus, cpu, node); #if defined(CONFIG_USER_ONLY) cpu_list_unlock();