Received: from eggs.gnu.org ([2001:4830:134:3::10]:45402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDBoR-0006Id-OJ for qemu-devel@nongnu.org; Thu, 09 Jul 2015 09:24:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDBoJ-00027d-17 for qemu-devel@nongnu.org; Thu, 09 Jul 2015 09:24:27 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45731 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDBoI-00027Y-R7 for qemu-devel@nongnu.org; Thu, 09 Jul 2015 09:24:18 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 9 Jul 2015 15:23:53 +0200 Message-Id: <1436448252-1916-4-git-send-email-afaerber@suse.de> In-Reply-To: <1436448252-1916-1-git-send-email-afaerber@suse.de> References: <1436448252-1916-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL v3 03/22] cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Eduardo Habkost 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=C3=A4rber --- exec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/exec.c b/exec.c index e2caee9..442df0d 100644 --- a/exec.c +++ b/exec.c @@ -533,6 +533,12 @@ void cpu_exec_init(CPUArchState *env) CPUState *some_cpu; int cpu_index; =20 +#ifndef CONFIG_USER_ONLY + cpu->as =3D &address_space_memory; + cpu->thread_id =3D 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 =3D cpu_index; -#ifndef CONFIG_USER_ONLY - cpu->as =3D &address_space_memory; - cpu->thread_id =3D qemu_get_thread_id(); - cpu_reload_memory_map(cpu); -#endif QTAILQ_INSERT_TAIL(&cpus, cpu, node); #if defined(CONFIG_USER_ONLY) cpu_list_unlock(); --=20 2.1.4