qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 15/19] do not provide qemu_event_increment if iothre


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 15/19] do not provide qemu_event_increment if iothread not used
Date: Mon, 21 Dec 2009 09:09:26 +0100

host_alarm_handler is using qemu_event_increment instead of qemu_notify_event.
After fixing this, the whole event business can be omitted if not using the
iothread.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 vl.c |  130 ++++++++++++++++++++++++++++++++----------------------------------
 1 files changed, 63 insertions(+), 67 deletions(-)

diff --git a/vl.c b/vl.c
index f7472db..11b1b70 100644
--- a/vl.c
+++ b/vl.c
@@ -1019,8 +1019,6 @@ static const VMStateDescription vmstate_timers = {
     }
 };
 
-static void qemu_event_increment(void);
-
 static void qemu_timer_bh(void *opaque)
 {
     struct qemu_alarm_timer *t = opaque;
@@ -1095,7 +1093,7 @@ static void host_alarm_handler(int host_signum)
                            qemu_get_clock(rt_clock)) ||
         qemu_timer_expired(active_timers[QEMU_CLOCK_HOST],
                            qemu_get_clock(host_clock))) {
-        qemu_event_increment();
+        qemu_notify_event();
         t->expired = alarm_has_dynticks(t);
 
 #ifndef CONFIG_IOTHREAD
@@ -3265,13 +3263,21 @@ void qemu_system_powerdown_request(void)
     qemu_notify_event();
 }
 
+static int cpu_can_run(CPUState *env)
+{
+    if (env->stop)
+        return 0;
+    if (env->stopped)
+        return 0;
+    return 1;
+}
+
 #ifdef CONFIG_IOTHREAD
 static void qemu_system_vmstop_request(int reason)
 {
     vmstop_requested = reason;
     qemu_notify_event();
 }
-#endif
 
 #ifndef _WIN32
 static int io_thread_fd = -1;
@@ -3354,69 +3360,6 @@ static void qemu_event_increment(void)
 }
 #endif
 
-static int cpu_can_run(CPUState *env)
-{
-    if (env->stop)
-        return 0;
-    if (env->stopped)
-        return 0;
-    return 1;
-}
-
-#ifndef CONFIG_IOTHREAD
-static int qemu_init_main_loop(void)
-{
-    return qemu_event_init();
-}
-
-void qemu_init_vcpu(void *_env)
-{
-    CPUState *env = _env;
-
-    if (kvm_enabled())
-        kvm_init_vcpu(env);
-    env->nr_cores = smp_cores;
-    env->nr_threads = smp_threads;
-    return;
-}
-
-int qemu_cpu_self(void *env)
-{
-    return 1;
-}
-
-static void resume_all_vcpus(void)
-{
-}
-
-static void pause_all_vcpus(void)
-{
-}
-
-void qemu_cpu_kick(void *env)
-{
-    return;
-}
-
-void qemu_notify_event(void)
-{
-    CPUState *env = cpu_single_env;
-
-    if (env) {
-        cpu_exit(env);
-    }
-}
-
-void qemu_mutex_lock_iothread(void) {}
-void qemu_mutex_unlock_iothread(void) {}
-
-void vm_stop(int reason)
-{
-    do_vm_stop(reason);
-}
-
-#else /* CONFIG_IOTHREAD */
-
 #include "qemu-thread.h"
 
 QemuMutex qemu_global_mutex;
@@ -3734,6 +3677,59 @@ void vm_stop(int reason)
     do_vm_stop(reason);
 }
 
+#else /* CONFIG_IOTHREAD */
+
+static int qemu_init_main_loop(void)
+{
+    return 0;
+}
+
+void qemu_init_vcpu(void *_env)
+{
+    CPUState *env = _env;
+
+    if (kvm_enabled())
+        kvm_init_vcpu(env);
+    env->nr_cores = smp_cores;
+    env->nr_threads = smp_threads;
+    return;
+}
+
+int qemu_cpu_self(void *env)
+{
+    return 1;
+}
+
+static void resume_all_vcpus(void)
+{
+}
+
+static void pause_all_vcpus(void)
+{
+}
+
+void qemu_cpu_kick(void *env)
+{
+    return;
+}
+
+void qemu_notify_event(void)
+{
+    CPUState *env = cpu_single_env;
+
+    if (env) {
+        cpu_exit(env);
+    }
+}
+
+void qemu_mutex_lock_iothread(void) {}
+void qemu_mutex_unlock_iothread(void) {}
+
+void vm_stop(int reason)
+{
+    do_vm_stop(reason);
+}
+
 #endif
 
 
-- 
1.6.5.2






reply via email to

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