[PATCH 8/9] kvm_send_ipi

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

 



Provide a wrapper to pthread kill. It is more elegant
because we only need to pass a CPUState pointer, meaning
"signall this cpu"

Signed-off-by: Glauber Costa <glommer@xxxxxxxxxx>
---
 qemu-kvm.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/qemu-kvm.c b/qemu-kvm.c
index 6d556b8..c89146d 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -66,6 +66,11 @@ static CPUState *kvm_debug_cpu_requested;
 
 static uint64_t phys_ram_size;
 
+static inline void kvm_send_ipi(CPUState *env)
+{
+    pthread_kill(env->kvm_cpu_state.thread, SIG_IPI);
+}
+
 /* The list of ioperm_data */
 static LIST_HEAD(, ioperm_data) ioperm_head;
 
@@ -1712,7 +1717,7 @@ static void on_vcpu(CPUState *env, void (*func)(void *data), void *data)
     wi.next = NULL;
     wi.done = false;
 
-    pthread_kill(env->kvm_cpu_state.thread, SIG_IPI);
+    kvm_send_ipi(env);
     while (!wi.done)
         qemu_cond_wait(&qemu_work_cond);
 }
@@ -1744,7 +1749,7 @@ void kvm_update_interrupt_request(CPUState *env)
         if (signal) {
             env->kvm_cpu_state.signalled = 1;
             if (env->kvm_cpu_state.thread)
-                pthread_kill(env->kvm_cpu_state.thread, SIG_IPI);
+                kvm_send_ipi(env);
         }
     }
 }
@@ -1892,7 +1897,7 @@ static void pause_all_threads(void)
     while (penv) {
         if (penv != cpu_single_env) {
             penv->stop = 1;
-            pthread_kill(penv->kvm_cpu_state.thread, SIG_IPI);
+            kvm_send_ipi(penv);
         } else {
             penv->stop = 0;
             penv->stopped = 1;
@@ -1914,7 +1919,7 @@ static void resume_all_threads(void)
     while (penv) {
         penv->stop = 0;
         penv->stopped = 0;
-        pthread_kill(penv->kvm_cpu_state.thread, SIG_IPI);
+        kvm_send_ipi(penv);
         penv = (CPUState *)penv->next_cpu;
     }
 }
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux