Hi Eduardo, On 2020/12/25 2:06, Eduardo Habkost wrote: >> >> The most time-consuming operation in haxm is ioctl(HAX_VM_IOCTL_VCPU_CREATE). >> Saddly this can not be split. >> >> Even if we fix the problem in haxm, other accelerators may also have >> this problem. So I think if we can make the x86_cpu_new() concurrently, >> we should try to do it. > > Changing the code to run all VCPU initialization actions for all > accelerators concurrently would require carefully reviewing the > VCPU thread code for all accelerators, looking for races. Sounds > like a challenging task. We could avoid that if we do something > that will parallelize only what we really need (and know to be > safe). >
Yes, we must make sure that all accelerators could work parallelly, even including the corresponding VCPU_CREATE_IOCTL, which is not under qemu's control. Fortunately, we have found out why ioctl(HAX_VM_IOCTL_VCPU_CREATE) in haxm took such a long time. It alloced vtlb when doing vcpu_create(), which has been discarded and is useless. After removing corresponding operation, the vcpu initialization time is reduced to within 10ms. Thanks for your attention and discussion. Thanks, Zhenyu