diff mbox

[07/20] qemu-kvm: Clean up kvm_update_interrupt_request

Message ID 6331a7b381965d2577b993606e2ad86743db3281.1306498737.git.jan.kiszka@siemens.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kiszka May 27, 2011, 12:19 p.m. UTC
Most tests in kvm_update_interrupt_request are unneeded today:
 - env argument is always non-NULL (caller references it as well)
 - current_env must have been created when we get here
 - env->thread can't be zero (initialized early during cpu creation)

So simply avoid self signaling and multiple kicks, drop the rest.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 cpus.c |   23 +++--------------------
 1 files changed, 3 insertions(+), 20 deletions(-)
diff mbox

Patch

diff --git a/cpus.c b/cpus.c
index bf666b0..152b596 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1250,26 +1250,9 @@  void on_vcpu(CPUState *env, void (*func)(void *data), void *data)
 
 void kvm_update_interrupt_request(CPUState *env)
 {
-    int signal = 0;
-
-    if (env) {
-        if (!current_env || !current_env->created) {
-            signal = 1;
-        }
-        /*
-         * Testing for created here is really redundant
-         */
-        if (current_env && current_env->created &&
-            env != current_env && !env->thread_kicked) {
-            signal = 1;
-        }
-
-        if (signal) {
-            env->thread_kicked = true;
-            if (env->thread) {
-                pthread_kill(env->thread->thread, SIG_IPI);
-            }
-        }
+    if (!qemu_cpu_is_self(env) && !env->thread_kicked) {
+        env->thread_kicked = true;
+        pthread_kill(env->thread->thread, SIG_IPI);
     }
 }