[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/37] Prevent abortion on multiple VCPU kicks
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 01/37] Prevent abortion on multiple VCPU kicks |
Date: |
Mon, 14 Feb 2011 13:22:30 -0200 |
From: Jan Kiszka <address@hidden>
If we call qemu_cpu_kick more than once before the target was able to
process the signal, pthread_kill will fail, and qemu will abort. Prevent
this by avoiding the redundant signal.
This logic can be found in qemu-kvm as well.
Signed-off-by: Jan Kiszka <address@hidden>
Signed-off-by: Marcelo Tosatti <address@hidden>
---
cpu-defs.h | 1 +
cpus.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/cpu-defs.h b/cpu-defs.h
index 8d4bf86..db809ed 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -205,6 +205,7 @@ typedef struct CPUWatchpoint {
uint32_t stopped; /* Artificially stopped */ \
struct QemuThread *thread; \
struct QemuCond *halt_cond; \
+ int thread_kicked; \
struct qemu_work_item *queued_work_first, *queued_work_last; \
const char *cpu_model_str; \
struct KVMState *kvm_state; \
diff --git a/cpus.c b/cpus.c
index 4c9928e..ab6e40e 100644
--- a/cpus.c
+++ b/cpus.c
@@ -481,6 +481,7 @@ static void qemu_wait_io_event_common(CPUState *env)
qemu_cond_signal(&qemu_pause_cond);
}
flush_queued_work(env);
+ env->thread_kicked = false;
}
static void qemu_tcg_wait_io_event(void)
@@ -648,7 +649,10 @@ void qemu_cpu_kick(void *_env)
{
CPUState *env = _env;
qemu_cond_broadcast(env->halt_cond);
- qemu_thread_signal(env->thread, SIG_IPI);
+ if (!env->thread_kicked) {
+ qemu_thread_signal(env->thread, SIG_IPI);
+ env->thread_kicked = true;
+ }
}
int qemu_cpu_self(void *_env)
--
1.7.4
- [Qemu-devel] [PATCH 00/37] [PULL] qemu-kvm.git uq/master queue, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 29/37] kvm: Separate TCG from KVM cpu execution, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 05/37] Leave inner main_loop faster on pending requests, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 24/37] Refactor cpu_has_work/any_cpu_has_work in cpus.c, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 25/37] Fix a few coding style violations in cpus.c, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 32/37] kvm: x86: Catch and report failing IRQ and NMI injections, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 01/37] Prevent abortion on multiple VCPU kicks,
Marcelo Tosatti <=
- [Qemu-devel] [PATCH 18/37] Introduce VCPU self-signaling service, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 27/37] Refactor debug and vmstop request interface, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 06/37] Flatten the main loop, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 21/37] kvm: Leave kvm_cpu_exec directly after KVM_EXIT_SHUTDOWN, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 33/37] kvm: Remove unneeded memory slot reservation, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 10/37] kvm: Provide sigbus services arch-independently, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 26/37] Improve vm_stop reason declarations, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 08/37] kvm: Drop redundant kvm_enabled from kvm_cpu_thread_fn, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 13/37] kvm: Refactor qemu_kvm_eat_signals, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 36/37] kvm: Make kvm_state globally available, Marcelo Tosatti, 2011/02/14