diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2010-02-17 20:14:42 -0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-02-22 10:58:33 +0200 |
commit | cc84de9570ffe01a9c3c169bd62ab9586a9a080c (patch) | |
tree | ea13b44d105ea50dd1f85ccade0f851481a905e6 /kvm-all.c | |
parent | fed6c3444c714e88eb84dae58fcde0182865db8f (diff) |
kvm: consume internal signal with sigtimedwait
Change the way the internal qemu signal, used for communication between
iothread and vcpus, is handled.
Block and consume it with sigtimedwait on the outer vcpu loop, which
allows more precise timing control.
Change from standard signal (SIGUSR1) to real-time one, so multiple
signals are not collapsed.
Set the signal number on KVM's in-kernel allowed sigmask.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r-- | kvm-all.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -771,6 +771,7 @@ int kvm_cpu_exec(CPUState *env) kvm_arch_post_run(env, run); if (ret == -EINTR || ret == -EAGAIN) { + cpu_exit(env); dprintf("io window exit\n"); ret = 0; break; @@ -1116,3 +1117,21 @@ void kvm_remove_all_breakpoints(CPUState *current_env) { } #endif /* !KVM_CAP_SET_GUEST_DEBUG */ + +int kvm_set_signal_mask(CPUState *env, const sigset_t *sigset) +{ + struct kvm_signal_mask *sigmask; + int r; + + if (!sigset) + return kvm_vcpu_ioctl(env, KVM_SET_SIGNAL_MASK, NULL); + + sigmask = qemu_malloc(sizeof(*sigmask) + sizeof(*sigset)); + + sigmask->len = 8; + memcpy(sigmask->sigset, sigset, sizeof(*sigset)); + r = kvm_vcpu_ioctl(env, KVM_SET_SIGNAL_MASK, sigmask); + free(sigmask); + + return r; +} |