[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a239fb653a040a62d1f3d76edecd2bf28b810135.camel@intel.com>
Date: Thu, 20 Feb 2025 21:55:21 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "pbonzini@...hat.com"
<pbonzini@...hat.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
CC: "seanjc@...gle.com" <seanjc@...gle.com>, "Zhao, Yan Y"
<yan.y.zhao@...el.com>, "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
Subject: Re: [PATCH 11/30] KVM: VMX: Refactor VMX module init/exit functions
> +static void __exit vt_exit(void)
> +{
> + kvm_exit();
> + vmx_exit();
> +}
> +module_exit(vt_exit);
> +
> +static int __init vt_init(void)
> +{
> + int r;
> +
> + r = vmx_init();
> + if (r)
> + return r;
> +
> + /*
> + * Common KVM initialization _must_ come last, after this, /dev/kvm is
> + * exposed to userspace!
> + */
> + r = kvm_init(sizeof(struct vcpu_vmx), __alignof__(struct vcpu_vmx),
> + THIS_MODULE);
> + if (r)
> + goto err_kvm_init;
> +
> + return 0;
> +
> +err_kvm_init:
> + vmx_exit();
> + return r;
> +}
> +module_init(vt_init);
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 6c56d5235f0f..8d3cfef0cf3b 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -8588,7 +8588,7 @@ __init int vmx_hardware_setup(void)
> return r;
> }
>
> -static void vmx_cleanup_l1d_flush(void)
> +static void __exit vmx_cleanup_l1d_flush(void)
> {
> if (vmx_l1d_flush_pages) {
> free_pages((unsigned long)vmx_l1d_flush_pages, L1D_CACHE_ORDER);
> @@ -8598,23 +8598,16 @@ static void vmx_cleanup_l1d_flush(void)
> l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
> }
>
> -static void __vmx_exit(void)
> +void __exit vmx_exit(void)
> {
> allow_smaller_maxphyaddr = false;
>
> vmx_cleanup_l1d_flush();
> -}
>
> -static void __exit vmx_exit(void)
> -{
> - kvm_exit();
> - __vmx_exit();
> kvm_x86_vendor_exit();
> -
> }
> -module_exit(vmx_exit);
>
Hi Paolo,
I think you will still meet the "section mismatch in reference: vt_init ..."
warning reported by LKP, for which I posted a diff to address:
https://lore.kernel.org/kvm/BL1PR11MB59780AA56D67068C906A40BAF7E02@BL1PR11MB5978.namprd11.prod.outlook.com/T/#m825784c4d3f5e2651455295d8f1bd9a4ac8ecdd8
Powered by blists - more mailing lists