[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aMFcwXEWMc2VIzQQ@intel.com>
Date: Wed, 10 Sep 2025 19:10:57 +0800
From: Chao Gao <chao.gao@...el.com>
To: "Huang, Kai" <kai.huang@...el.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "linux-pm@...r.kernel.org"
<linux-pm@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "xin@...or.com" <xin@...or.com>,
"brgerst@...il.com" <brgerst@...il.com>, "andrew.cooper3@...rix.com"
<andrew.cooper3@...rix.com>, "arjan@...ux.intel.com" <arjan@...ux.intel.com>,
"Williams, Dan J" <dan.j.williams@...el.com>, "dave.hansen@...ux.intel.com"
<dave.hansen@...ux.intel.com>, "Edgecombe, Rick P"
<rick.p.edgecombe@...el.com>, "seanjc@...gle.com" <seanjc@...gle.com>,
"mingo@...hat.com" <mingo@...hat.com>, "pbonzini@...hat.com"
<pbonzini@...hat.com>, "tglx@...utronix.de" <tglx@...utronix.de>,
"hpa@...or.com" <hpa@...or.com>, "peterz@...radead.org"
<peterz@...radead.org>, "pavel@...nel.org" <pavel@...nel.org>, "bp@...en8.de"
<bp@...en8.de>, "kprateek.nayak@....com" <kprateek.nayak@....com>,
"rafael@...nel.org" <rafael@...nel.org>, "david.kaplan@....com"
<david.kaplan@....com>, "x86@...nel.org" <x86@...nel.org>
Subject: Re: [RFC PATCH v1 1/5] x86/boot: Shift VMXON from KVM init to CPU
startup phase
>> @@ -2551,6 +2636,12 @@ void __init arch_cpu_finalize_init(void)
>> *c = boot_cpu_data;
>> c->initialized = true;
>>
>> + /*
>> + * Enable BSP virtualization right after the BSP cpuinfo_x86 structure
>> + * is initialized to ensure this_cpu_has() works as expected.
>> + */
>> + cpu_enable_virtualization();
>> +
>>
>
>Any reason that you choose to do it in arch_cpu_finalize_init()? Perhaps
>just a arch_initcall() or similar?
>
>KVM has a specific CPUHP_AP_KVM_ONLINE to handle VMXON/OFF for CPU
>online/offline. And it's not in STARTUP section (which is not allowed to
>fail) so it can handle the failure of VMXON.
>
>How about adding a VMX specific CPUHP callback instead?
>
>In this way, not only we can put all VMX related code together (e.g.,
>arch/x86/virt/vmx/vmx.c) which is way easier to review/maintain, but also
>we can still handle the failure of VMXON just like in KVM.
KVM's policy is that a CPU can be online if there is no VM running. It is hard
to implement/move the same logic inside the core kernel because the core kernel
would need to refcount the running VMs. Any idea/suggestion on how to handle
VMXON failure in the core kernel?
Powered by blists - more mailing lists