From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTgAW-0007R7-TK for qemu-devel@nongnu.org; Sun, 23 Aug 2015 21:03:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTgAS-00060H-SM for qemu-devel@nongnu.org; Sun, 23 Aug 2015 21:03:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTgAS-00060D-MZ for qemu-devel@nongnu.org; Sun, 23 Aug 2015 21:03:20 -0400 References: <1440375847-17603-1-git-send-email-cota@braap.org> <1440375847-17603-4-git-send-email-cota@braap.org> From: Paolo Bonzini Message-ID: <55DA6D53.2080709@redhat.com> Date: Sun, 23 Aug 2015 18:03:15 -0700 MIME-Version: 1.0 In-Reply-To: <1440375847-17603-4-git-send-email-cota@braap.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 03/38] cpu-exec: set current_cpu at cpu_exec() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , qemu-devel@nongnu.org, mttcg@greensocs.com Cc: guillaume.delbergue@greensocs.com, alex.bennee@linaro.org, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, Frederic Konrad On 23/08/2015 17:23, Emilio G. Cota wrote: > So that it applies to usermode as well. > > Signed-off-by: Emilio G. Cota > --- > cpu-exec.c | 2 ++ > cpus.c | 1 - > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/cpu-exec.c b/cpu-exec.c > index b8a11e1..2b9a447 100644 > --- a/cpu-exec.c > +++ b/cpu-exec.c > @@ -386,6 +386,8 @@ int cpu_exec(CPUState *cpu) > uintptr_t next_tb; > SyncClocks sc; > > + current_cpu = cpu; > + > #ifndef CONFIG_USER_ONLY > /* FIXME: user-mode emulation probably needs a similar mechanism as well, > * for example for tb_flush. > diff --git a/cpus.c b/cpus.c > index 5484ce6..0fe6576 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -1079,7 +1079,6 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) > cpu->thread_id = qemu_get_thread_id(); > cpu->created = true; > cpu->can_do_io = 1; > - current_cpu = cpu; > > qemu_cond_signal(&qemu_cpu_cond); Please set it somewhere in linux-user/ and bsd-user/ instead, I would like to keep the TCG code more similar to KVM/Xen/qtest. Probably the whole qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; current_cpu = cpu; should be moved into a new function (rcu_register_thread too?). Paolo