From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V54Qh-0006Qx-MH for qemu-devel@nongnu.org; Thu, 01 Aug 2013 21:45:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V54Qa-0006bC-SH for qemu-devel@nongnu.org; Thu, 01 Aug 2013 21:45:19 -0400 Received: from mail.windriver.com ([147.11.1.11]:44447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V54Qa-0006ay-Gw for qemu-devel@nongnu.org; Thu, 01 Aug 2013 21:45:12 -0400 Message-ID: <51FB0F21.9090009@windriver.com> Date: Fri, 2 Aug 2013 09:45:05 +0800 From: =?UTF-8?B?IuKAnHRpZWp1bi5jaGVu4oCdIg==?= MIME-Version: 1.0 References: <1374828431-25517-1-git-send-email-tiejun.chen@windriver.com> <51FA48AC.9070905@suse.de> In-Reply-To: <51FA48AC.9070905@suse.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] cpus: use cpu_is_stopped efficiently List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: mtosatti@redhat.com, qemu-devel@nongnu.org On 08/01/2013 07:38 PM, =EF=BF=BD wrote: > Hi, > > Am 26.07.2013 10:47, schrieb Tiejun Chen: >> It makes more sense and simple later. >> >> 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 =3D ENV_GET_CPU(env); > > To optimize performance slightly, I would suggest to reorder the two > conditions as they were below (avoiding the non-inline function call if > cpu->stopped). Good idea. > > Other than that it looks good to me, but no bugfix for 1.6. > If you send a v2 I can queue it on qom-cpu for the next merge window in > two weeks. I already send this v2 just now. > > CC'ing me would have made me review it earlier. ;) And as you may have > noticed, Avi is no longer with Red Hat, and Gleb and Paolo are > maintaining KVM parts, which there are none in this patch. See > MAINTAINERS file for the latest list. Thanks for your information :) Tiejun > > Regards, > Andreas > >> @@ -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; >> > >