From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPsCi-0006jf-IU for qemu-devel@nongnu.org; Thu, 13 Aug 2015 09:06:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPsCc-0005l6-F1 for qemu-devel@nongnu.org; Thu, 13 Aug 2015 09:05:56 -0400 Received: from greensocs.com ([193.104.36.180]:38460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPsCc-0005kg-0D for qemu-devel@nongnu.org; Thu, 13 Aug 2015 09:05:50 -0400 Message-ID: <55CC962A.5020103@greensocs.com> Date: Thu, 13 Aug 2015 15:05:46 +0200 From: Frederic Konrad MIME-Version: 1.0 References: <1439397664-70734-1-git-send-email-pbonzini@redhat.com> <1439397664-70734-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1439397664-70734-3-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/10] cpus: remove tcg_halt_cond global variable. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: mttcg@greensocs.com On 12/08/2015 18:40, Paolo Bonzini wrote: > From: KONRAD Frederic > > This removes tcg_halt_cond global variable. > We need one QemuCond per virtual cpu for multithread TCG. > > Signed-off-by: KONRAD Frederic > Message-Id: <1439220437-23957-9-git-send-email-fred.konrad@greensocs.com> > [Keep tcg_halt_cond for bisectability, while making it static. - Paolo] How does that help bisectability? Fred > Signed-off-by: Paolo Bonzini > --- > cpus.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/cpus.c b/cpus.c > index 9224488..8884278 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -813,7 +813,6 @@ static unsigned iothread_requesting_mutex; > static QemuThread io_thread; > > static QemuThread *tcg_cpu_thread; > -static QemuCond *tcg_halt_cond; > > /* cpu creation */ > static QemuCond qemu_cpu_cond; > @@ -933,15 +932,13 @@ static void qemu_wait_io_event_common(CPUState *cpu) > cpu->thread_kicked = false; > } > > -static void qemu_tcg_wait_io_event(void) > +static void qemu_tcg_wait_io_event(CPUState *cpu) > { > - CPUState *cpu; > - > while (all_cpu_threads_idle()) { > /* Start accounting real time to the virtual clock if the CPUs > are idle. */ > qemu_clock_warp(QEMU_CLOCK_VIRTUAL); > - qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex); > + qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); > } > > while (iothread_requesting_mutex) { > @@ -1067,7 +1064,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) > > /* wait for initial kick-off after machine start */ > while (first_cpu->stopped) { > - qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex); > + qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); > > /* process any pending work */ > CPU_FOREACH(cpu) { > @@ -1088,7 +1085,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) > qemu_clock_notify(QEMU_CLOCK_VIRTUAL); > } > } > - qemu_tcg_wait_io_event(); > + qemu_tcg_wait_io_event(QTAILQ_FIRST(&cpus)); > } > > return NULL; > @@ -1265,6 +1262,7 @@ void resume_all_vcpus(void) > static void qemu_tcg_init_vcpu(CPUState *cpu) > { > char thread_name[VCPU_THREAD_NAME_SIZE]; > + static QemuCond *tcg_halt_cond; > > tcg_cpu_address_space_init(cpu, cpu->as); >