From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4qr4-0004t0-Gr for qemu-devel@nongnu.org; Thu, 01 Aug 2013 07:15:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4qqx-0003eD-MC for qemu-devel@nongnu.org; Thu, 01 Aug 2013 07:15:38 -0400 Received: from mail.windriver.com ([147.11.1.11]:50435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4qqx-0003c1-7E for qemu-devel@nongnu.org; Thu, 01 Aug 2013 07:15:31 -0400 Message-ID: <51FA1853.5000300@windriver.com> Date: Thu, 1 Aug 2013 16:12:03 +0800 From: =?UTF-8?B?IuKAnHRpZWp1bi5jaGVu4oCdIg==?= MIME-Version: 1.0 References: <1374828431-25517-1-git-send-email-tiejun.chen@windriver.com> In-Reply-To: <1374828431-25517-1-git-send-email-tiejun.chen@windriver.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] cpus: use cpu_is_stopped efficiently List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mtosatti@redhat.com, avi.kivity@gmail.com On 07/26/2013 04:47 PM, Tiejun Chen wrote: > It makes more sense and simple later. Any feedback :) Tiejun > > Signed-off-by: Tiejun Chen > --- > cpus.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/cpus.c b/cpus.c > index c232265..a997632 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -62,6 +62,11 @@ > > static CPUArchState *next_cpu; > > +bool cpu_is_stopped(CPUState *cpu) > +{ > + return !runstate_is_running() || cpu->stopped; > +} > + > static bool cpu_thread_is_idle(CPUArchState *env) > { > CPUState *cpu = ENV_GET_CPU(env); > @@ -69,7 +74,7 @@ static bool cpu_thread_is_idle(CPUArchState *env) > if (cpu->stop || cpu->queued_work_first) { > return false; > } > - if (cpu->stopped || !runstate_is_running()) { > + if (cpu_is_stopped(cpu)) { > return true; > } > if (!cpu->halted || qemu_cpu_has_work(cpu) || > @@ -432,11 +437,6 @@ void cpu_synchronize_all_post_init(void) > } > } > > -bool cpu_is_stopped(CPUState *cpu) > -{ > - return !runstate_is_running() || cpu->stopped; > -} > - > static void do_vm_stop(RunState state) > { > if (runstate_is_running()) { > @@ -455,7 +455,7 @@ static bool cpu_can_run(CPUState *cpu) > if (cpu->stop) { > return false; > } > - if (cpu->stopped || !runstate_is_running()) { > + if (cpu_is_stopped(cpu)) { > return false; > } > return true; >