[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2] x86/cpu: initialize the CPU concurrently
From: |
Zhenyu Ye |
Subject: |
Re: [RFC PATCH v2] x86/cpu: initialize the CPU concurrently |
Date: |
Thu, 31 Dec 2020 17:34:35 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 |
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