Reputation: 404
I'm trying to learn Qemu-KVM in order to extend them for a monitoring application. I can see that the general control flow in qemu/kvm-all.c
is:
kvm_init() :
kvm_ioctl(s, KVM_CREATE_VM, 0);
kvm_init_vcpu() : kvm_vm_ioctl(s, KVM_CREATE_VCPU, env->cpu_index);
kvm_cpu_exec() :
do {
kvm_vcpu_ioctl(env, KVM_RUN, 0);
switch (run->exit_reason) { // giving control to Qemu
case KVM_EXIT_IO:
case KVM_EXIT_MMIO:
... // omitted
} while();
What I can't see yet is when (what KVM functions in the source code) return to (or call) Qemu (user space) to handle KVM exit ?
Upvotes: 2
Views: 345
Reputation: 404
In fact, what I found is that Qemu simply waits (blocked) for kvm_vcpu_ioctl(env, KVM_RUN, 0) to return. So this is when KVM returns back the control to Qemu.
Upvotes: 2