You are absolute right and this solved the puzzle. I also did profiling to confirm your observation. Thank you for all the help! > Hi again, I took another look at qemu-kvm 0.12.3 and here is how I read it: > > The mutex which is supposed to protect IO emulation is qemu-kvm.c:qemu_mutex. > > The cpu thread will unlock qemu_mutex in pre_kvm_run() before > ioctl(fd, KVM_RUN, 0). Then it will lock qemu_mutex again in > post_kvm_run(). > > The io thread will unlock qemu_mutex via > qemu-kvm.c:qemu_mutex_unlock_iothread() before waiting in select(). > Then it will lock qemu_mutex again in > qemu-kvm.c:qemu_mutex_lock_iothread(). > > I believe this *does* protect IO emulation correctly. The code is > confusing because there are multiple definitions of the same functions > and #ifdefs, maybe I made a mistake. Regards, CQ Tang -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html