Skip to contentSkip to conversation

scheduling of qemu threads

Qemu-devel David S. Ahern 2 participants 3 messages Jul 31, 2008 – Aug 1, 2008

lore
Share & tools
lore
#0 lore raw

Last week or so Anthony made a comment about qemu basically being single threaded given its global mutex. What are the impacts to simultaneous scheduling of qemu threads? As I understand it, qemu has a main thread, a monitor thread, an IO thread and a thread for each vcpu. Can 2 or more vcpu threads run concurrently? Can a vcpu thread and an IO thread run concurrently? Does kvm alter the concurrency?

david

#1 lore raw
Quoted 7 lines · David S. Ahern

Last week or so Anthony made a comment about qemu basically being single threaded given its global mutex. What are the impacts to simultaneous scheduling of qemu threads? As I understand it, qemu has a main thread, a monitor thread, an IO thread and a thread for each vcpu. Can 2 or more vcpu threads run concurrently? Can a vcpu thread and an IO thread run concurrently? Does kvm alter the concurrency?

All threads run in lock-step except when a VCPU is running (via kvm_run). So a VCPU can run while the IO thread is active. Only one VCPU can execute IO at a given time though.

Regards,

Anthony Liguori

Quoted 2 lines

david

#2 lore raw
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · David S. Ahern

Last week or so Anthony made a comment about qemu basically being single threaded given its global mutex. What are the impacts to simultaneous scheduling of qemu threads? As I understand it, qemu has a main thread, a monitor thread, an IO thread and a thread for each vcpu. Can 2 or more vcpu threads run concurrently? Can a vcpu thread and an IO thread run concurrently? Does kvm alter the concurrency?

Quoted 3 lines

All threads run in lock-step except when a VCPU is running (via kvm_run). So a VCPU can run while the IO thread is active. Only one VCPU can execute IO at a given time though.

Not to be dense, but do you mean yes 2 or more vcpu threads can be run at the same time? I ask because it does not make sense for them not to be performance wise, but at the same time following the code from kvm_main_loop_cpu() to kvm_run() I do not see the qemu_mutex unlocked before the ioctl(). I only see it unlocked in kvm_main_loop_wait().

thanks,
david

Quoted 9 lines

Regards,

Anthony Liguori

Quoted 2 lines

david