qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] cpus: use cpu_is_stopped efficiently


From: “tiejun.chen”
Subject: Re: [Qemu-devel] [PATCH] cpus: use cpu_is_stopped efficiently
Date: Thu, 1 Aug 2013 16:12:03 +0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7

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 <address@hidden>
---
  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;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]