[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/37] kvm: Refactor qemu_kvm_eat_signals
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 13/37] kvm: Refactor qemu_kvm_eat_signals |
Date: |
Mon, 14 Feb 2011 13:22:42 -0200 |
From: Jan Kiszka <address@hidden>
We do not use the timeout, so drop its logic. As we always poll our
signals, we do not need to drop the global lock. Removing those calls
allows some further simplifications. Also fix the error processing of
sigpending at this chance.
Signed-off-by: Jan Kiszka <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Marcelo Tosatti <address@hidden>
---
cpus.c | 23 +++++++----------------
1 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/cpus.c b/cpus.c
index f27dfbd..d9c9111 100644
--- a/cpus.c
+++ b/cpus.c
@@ -644,31 +644,22 @@ static void sigbus_handler(int n, struct
qemu_signalfd_siginfo *siginfo,
}
}
-static void qemu_kvm_eat_signal(CPUState *env, int timeout)
+static void qemu_kvm_eat_signals(CPUState *env)
{
- struct timespec ts;
- int r, e;
+ struct timespec ts = { 0, 0 };
siginfo_t siginfo;
sigset_t waitset;
sigset_t chkset;
-
- ts.tv_sec = timeout / 1000;
- ts.tv_nsec = (timeout % 1000) * 1000000;
+ int r;
sigemptyset(&waitset);
sigaddset(&waitset, SIG_IPI);
sigaddset(&waitset, SIGBUS);
do {
- qemu_mutex_unlock(&qemu_global_mutex);
-
r = sigtimedwait(&waitset, &siginfo, &ts);
- e = errno;
-
- qemu_mutex_lock(&qemu_global_mutex);
-
- if (r == -1 && !(e == EAGAIN || e == EINTR)) {
- fprintf(stderr, "sigtimedwait: %s\n", strerror(e));
+ if (r == -1 && !(errno == EAGAIN || errno == EINTR)) {
+ perror("sigtimedwait");
exit(1);
}
@@ -684,7 +675,7 @@ static void qemu_kvm_eat_signal(CPUState *env, int timeout)
r = sigpending(&chkset);
if (r == -1) {
- fprintf(stderr, "sigpending: %s\n", strerror(e));
+ perror("sigpending");
exit(1);
}
} while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS));
@@ -695,7 +686,7 @@ static void qemu_kvm_wait_io_event(CPUState *env)
while (!cpu_has_work(env))
qemu_cond_timedwait(env->halt_cond, &qemu_global_mutex, 1000);
- qemu_kvm_eat_signal(env, 0);
+ qemu_kvm_eat_signals(env);
qemu_wait_io_event_common(env);
}
--
1.7.4
- [Qemu-devel] [PATCH 32/37] kvm: x86: Catch and report failing IRQ and NMI injections, (continued)
- [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, 2011/02/14
- [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 <=
- [Qemu-devel] [PATCH 36/37] kvm: Make kvm_state globally available, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 03/37] Process vmstop requests in IO thread, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 19/37] kvm: Unconditionally reenter kernel after IO exits, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 09/37] kvm: Handle kvm_init_vcpu errors, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 12/37] kvm: Set up signal mask also for !CONFIG_IOTHREAD, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 20/37] kvm: Remove static return code of kvm_handle_io, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 35/37] cirrus: Remove obsolete kvm.h include, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 28/37] Move debug exception handling out of cpu_exec, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 07/37] kvm: Report proper error on GET_VCPU_MMAP_SIZE failures, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 11/37] Refactor signal setup functions in cpus.c, Marcelo Tosatti, 2011/02/14