mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 20:33:54 -06:00
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>
This commit is contained in:
parent
fed6c3444c
commit
cc84de9570
3 changed files with 97 additions and 12 deletions
19
kvm-all.c
19
kvm-all.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue