From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTXrr-0005Pf-9W for qemu-devel@nongnu.org; Thu, 05 Mar 2015 10:39:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTXrk-0000EQ-IL for qemu-devel@nongnu.org; Thu, 05 Mar 2015 10:39:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTXrk-0000EA-Ay for qemu-devel@nongnu.org; Thu, 05 Mar 2015 10:39:12 -0500 From: Eduardo Habkost Date: Thu, 5 Mar 2015 12:38:47 -0300 Message-Id: <1425569930-6660-4-git-send-email-ehabkost@redhat.com> In-Reply-To: <1425569930-6660-1-git-send-email-ehabkost@redhat.com> References: <1425569930-6660-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 3/6] cpu: Reorder cpu->as and cpu->thread_id initialization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: zhugh.fnst@cn.fujitsu.com, tangchen@cn.fujitsu.com, chen.fan.fnst@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com, Paolo Bonzini , Gu Zheng , Igor Mammedov , anshul.makkar@profitbricks.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= Instead of initializing cpu->as and cpu->thread_id while holding cpu_list_lock(), initialize it earlier. This allows the code handling cpu_index and global CPU list to be isolated from the rest. Signed-off-by: Eduardo Habkost --- exec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index 8220535..2e370d0 100644 --- a/exec.c +++ b/exec.c @@ -534,6 +534,11 @@ 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(); +#endif + #if defined(CONFIG_USER_ONLY) cpu_list_lock(); #endif @@ -542,10 +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(); -#endif QTAILQ_INSERT_TAIL(&cpus, cpu, node); #if defined(CONFIG_USER_ONLY) cpu_list_unlock(); -- 2.1.0