* [PATCH] qemu-kvm: Consolidate kvm_eat_signal v2
@ 2008-05-16 7:21 Jan Kiszka
2008-05-19 11:43 ` [kvm-devel] " Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2008-05-16 7:21 UTC (permalink / raw)
To: kvm-devel; +Cc: Avi Kivity
Here comes the second revision of the attempt to consolidate
kvm_eat_signal[s]. It follows the suggestions to remove looping over
kvm_eat_signal and folds everything into kvm_main_loop_wait.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
qemu/qemu-kvm.c | 43 ++++++++-----------------------------------
1 file changed, 8 insertions(+), 35 deletions(-)
Index: b/qemu/qemu-kvm.c
===================================================================
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -173,64 +173,37 @@ static int has_work(CPUState *env)
return kvm_arch_has_work(env);
}
-static int kvm_eat_signal(CPUState *env, int timeout)
+static void kvm_main_loop_wait(CPUState *env, int timeout)
{
struct timespec ts;
- int r, e, ret = 0;
+ int r, e;
siginfo_t siginfo;
sigset_t waitset;
+ pthread_mutex_unlock(&qemu_mutex);
+
ts.tv_sec = timeout / 1000;
ts.tv_nsec = (timeout % 1000) * 1000000;
sigemptyset(&waitset);
sigaddset(&waitset, SIG_IPI);
r = sigtimedwait(&waitset, &siginfo, &ts);
- if (r == -1 && (errno == EAGAIN || errno == EINTR) && !timeout)
- return 0;
e = errno;
pthread_mutex_lock(&qemu_mutex);
- if (env && vcpu)
- cpu_single_env = vcpu->env;
- if (r == -1 && !(errno == EAGAIN || errno == EINTR)) {
+
+ if (r == -1 && !(e == EAGAIN || e == EINTR)) {
printf("sigtimedwait: %s\n", strerror(e));
exit(1);
}
- if (r != -1)
- ret = 1;
- if (env && vcpu_info[env->cpu_index].stop) {
+ if (vcpu_info[env->cpu_index].stop) {
vcpu_info[env->cpu_index].stop = 0;
vcpu_info[env->cpu_index].stopped = 1;
pthread_cond_signal(&qemu_pause_cond);
}
- pthread_mutex_unlock(&qemu_mutex);
-
- return ret;
-}
-
-
-static void kvm_eat_signals(CPUState *env, int timeout)
-{
- int r = 0;
-
- while (kvm_eat_signal(env, 0))
- r = 1;
- if (!r && timeout) {
- r = kvm_eat_signal(env, timeout);
- if (r)
- while (kvm_eat_signal(env, 0))
- ;
- }
-}
-
-static void kvm_main_loop_wait(CPUState *env, int timeout)
-{
- pthread_mutex_unlock(&qemu_mutex);
- kvm_eat_signals(env, timeout);
- pthread_mutex_lock(&qemu_mutex);
cpu_single_env = env;
+
vcpu_info[env->cpu_index].signalled = 0;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [kvm-devel] [PATCH] qemu-kvm: Consolidate kvm_eat_signal v2
2008-05-16 7:21 [PATCH] qemu-kvm: Consolidate kvm_eat_signal v2 Jan Kiszka
@ 2008-05-19 11:43 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-05-19 11:43 UTC (permalink / raw)
To: Jan Kiszka; +Cc: kvm-devel
Jan Kiszka wrote:
> Here comes the second revision of the attempt to consolidate
> kvm_eat_signal[s]. It follows the suggestions to remove looping over
> kvm_eat_signal and folds everything into kvm_main_loop_wait.
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-19 11:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-16 7:21 [PATCH] qemu-kvm: Consolidate kvm_eat_signal v2 Jan Kiszka
2008-05-19 11:43 ` [kvm-devel] " Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox