qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Tiejun Chen" <tiejun.chen@windriver.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PULL 6/6] cpus: Use cpu_is_stopped() efficiently
Date: Fri, 16 Aug 2013 18:56:43 +0200	[thread overview]
Message-ID: <1376672203-31191-7-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1376672203-31191-1-git-send-email-afaerber@suse.de>

From: Tiejun Chen <tiejun.chen@windriver.com>

It makes more sense and will make things simpler later.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 cpus.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/cpus.c b/cpus.c
index 0f65e76..70cc617 100644
--- a/cpus.c
+++ b/cpus.c
@@ -62,12 +62,17 @@
 
 static CPUState *next_cpu;
 
+bool cpu_is_stopped(CPUState *cpu)
+{
+    return cpu->stopped || !runstate_is_running();
+}
+
 static bool cpu_thread_is_idle(CPUState *cpu)
 {
     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) ||
@@ -429,11 +434,6 @@ void cpu_synchronize_all_post_init(void)
     }
 }
 
-bool cpu_is_stopped(CPUState *cpu)
-{
-    return !runstate_is_running() || cpu->stopped;
-}
-
 static int do_vm_stop(RunState state)
 {
     int ret = 0;
@@ -457,7 +457,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;
-- 
1.8.1.4

      parent reply	other threads:[~2013-08-16 16:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16 16:56 [Qemu-devel] [PULL 0/6] QOM CPUState patch queue 2013-08-16 Andreas Färber
2013-08-16 16:56 ` [Qemu-devel] [PULL 1/6] gdbstub: Fix gdb_register_coprocessor() register counting Andreas Färber
2013-08-16 16:56 ` [Qemu-devel] [PULL 2/6] tests: Unit tests for qdev global properties handling Andreas Färber
2013-08-16 16:56 ` [Qemu-devel] [PULL 3/6] qom: Introduce instance_post_init hook Andreas Färber
2013-08-16 16:56 ` [Qemu-devel] [PULL 4/6] qdev: Set globals in instance_post_init function Andreas Färber
2013-08-16 16:56 ` [Qemu-devel] [PULL 5/6] target-i386: Move hyperv_* static globals to X86CPU Andreas Färber
2013-08-16 16:56 ` Andreas Färber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376672203-31191-7-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=tiejun.chen@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).