|
From: | Xiaoyao Li |
Subject: | Re: [PATCH v1 0/4] Initialize nr_cores and nr_threads early and related clearup |
Date: | Fri, 22 Nov 2024 10:40:26 +0800 |
User-agent: | Mozilla Thunderbird |
On 11/22/2024 2:52 AM, Paolo Bonzini wrote:
On 11/21/24 17:24, Xiaoyao Li wrote:Could it go into cpu_common_initfn()?It can, I think.I'll move them into cpu_common_initfn() in v2 to avoid touching all the ARCHes.It does look better than the alternative of duplicating code.On the other hand qemu_init_vcpu is already duplicated and I'm not sure I like relying on qdev_get_machine() inside the instance_init function...
I had the same concern.But it seems all the ARCHes should create MACHINE before VCPUs. So it seems OK to qdev_get_machine() inside the instance_init function. But I'm not sure if there is any case to create VCPU standalone.
I think we can check if qdev_get_machine() gets a valid result. If not, fall back to assign nr_cores and nr_threads to 1.
Anyway, please let me know your preference, this series or a v2 to implement it inside cpu_common_initfn().
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |