From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTYv0-0007rh-5C for qemu-devel@nongnu.org; Thu, 05 Mar 2015 11:46:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTYuv-0002Pq-6T for qemu-devel@nongnu.org; Thu, 05 Mar 2015 11:46:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52477) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTYuu-0002PP-Uc for qemu-devel@nongnu.org; Thu, 05 Mar 2015 11:46:33 -0500 Date: Thu, 5 Mar 2015 17:22:46 +0100 From: Igor Mammedov Message-ID: <20150305172246.5c71573c@nial.brq.redhat.com> In-Reply-To: <1425569930-6660-4-git-send-email-ehabkost@redhat.com> References: <1425569930-6660-1-git-send-email-ehabkost@redhat.com> <1425569930-6660-4-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [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: Eduardo Habkost Cc: zhugh.fnst@cn.fujitsu.com, qemu-devel@nongnu.org, tangchen@cn.fujitsu.com, chen.fan.fnst@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com, anshul.makkar@profitbricks.com, Gu Zheng , Paolo Bonzini , Andreas =?UTF-8?B?RsOkcmJlcg==?= On Thu, 5 Mar 2015 12:38:47 -0300 Eduardo Habkost wrote: > 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 Reviewed-by: Igor Mammedov > --- > 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();