On 03/03/2016 07:09, Gaurav Sharma wrote: > Hi was trying to do some digging for multi core scenarios both with and > without KVM. > > In short i have some devices and a user application that does some r/w > operations on those devices. > > As per my understanding, in case binary translation using TCG is > invoked, we only create a single Qemuthread for all vcpu's. In case of > KVM we have a Qemuthread for each vcpu as TCG is bypassed in this case. > > > [Test scenario] > Lets say i have devices dev1 and dev2. Test application for dev1 is > executed on core0 and dev2 on core1. > For device dev1, for testing purposes i specified some sleep whenever a > read comes. > In case KVM is enabled, whenever the sleep is hit my whole VM freezes. > > 1. Are are devices emulated in a separate single thread ?
No, but device emulation and I/O all run behind the same mutex (affectionately called "big QEMU lock"). See qemu_mutex_lock_iothread and qemu_mutex_unlock_iothread. Paolo > 2. How and where in the code do we do a switch between CPU thread and > IOthread ?