@@ -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;
}
}
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@redhat.com> --- qemu-kvm.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)