[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 6/6] cpus: Use cpu_is_stopped() efficiently
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 6/6] cpus: Use cpu_is_stopped() efficiently |
Date: |
Fri, 16 Aug 2013 18:56:43 +0200 |
From: Tiejun Chen <address@hidden>
It makes more sense and will make things simpler later.
Signed-off-by: Tiejun Chen <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
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
- [Qemu-devel] [PULL 0/6] QOM CPUState patch queue 2013-08-16, Andreas Färber, 2013/08/16
- [Qemu-devel] [PULL 4/6] qdev: Set globals in instance_post_init function, Andreas Färber, 2013/08/16
- [Qemu-devel] [PULL 1/6] gdbstub: Fix gdb_register_coprocessor() register counting, Andreas Färber, 2013/08/16
- [Qemu-devel] [PULL 2/6] tests: Unit tests for qdev global properties handling, Andreas Färber, 2013/08/16
- [Qemu-devel] [PULL 5/6] target-i386: Move hyperv_* static globals to X86CPU, Andreas Färber, 2013/08/16
- [Qemu-devel] [PULL 3/6] qom: Introduce instance_post_init hook, Andreas Färber, 2013/08/16
- [Qemu-devel] [PULL 6/6] cpus: Use cpu_is_stopped() efficiently,
Andreas Färber <=