On 24/01/2025 11:54 am, Edgecombe, Rick P wrote:
On Thu, 2025-01-23 at 08:35 +0000, Huang, Kai wrote:
I checked the code, I think it is because vt_init() calls vmx_exit() in the error path when kvm_init() fails.
vt_init() is annotated with __init and vmx_exit() is annotated with __exit.
Yea. The __exit was just added recently:
https://lore.kernel.org/kvm/20250102154050.2403-1-costas.argyris@xxxxxxx/
Yeah the __exit was added (back) because vmx_exit() is no longer called
in the __init path. Now with vt_init() for TDX, vmx_exit() is called by
vt_init() again in the error handling path. I think we should just drop
the __exit again in this patch.
I tried below code change and the warning disappeared:
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 58915395da8a..9ab3507248c6 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -8586,7 +8586,7 @@ __init int vmx_hardware_setup(void)
return r;
}
-static void __exit vmx_cleanup_l1d_flush(void)
+static void vmx_cleanup_l1d_flush(void)
{
if (vmx_l1d_flush_pages) {
free_pages((unsigned long)vmx_l1d_flush_pages,
L1D_CACHE_ORDER);
@@ -8596,7 +8596,7 @@ static void __exit vmx_cleanup_l1d_flush(void)
l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
}
-void __exit vmx_exit(void)
+void vmx_exit(void)
{
allow_smaller_maxphyaddr = false;