Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>, lkp <lkp@intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"llvm@lists.linux.dev" <llvm@lists.linux.dev>,
	"Chen, Farrah" <Farrah.Chen@intel.com>,
	"oe-kbuild-all@lists.linux.dev" <oe-kbuild-all@lists.linux.dev>
Subject: Re: [kvm:kvm-coco-queue 39/125] WARNING: modpost: vmlinux: section mismatch in reference: vt_init+0x2f (section: .init.text) -> vmx_exit (section: .exit.text)
Date: Fri, 7 Feb 2025 10:30:06 +1300	[thread overview]
Message-ID: <22e0e826-27f0-4988-bf22-1e8c327928ea@intel.com> (raw)
In-Reply-To: <9a9fbef8ce874f15a5c8fdd24f2958a4f76c6080.camel@intel.com>



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@amd.com/

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;


      reply	other threads:[~2025-02-06 21:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23  4:54 [kvm:kvm-coco-queue 39/125] WARNING: modpost: vmlinux: section mismatch in reference: vt_init+0x2f (section: .init.text) -> vmx_exit (section: .exit.text) kernel test robot
2025-01-23  8:35 ` Huang, Kai
2025-01-23 22:54   ` Edgecombe, Rick P
2025-02-06 21:30     ` Huang, Kai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22e0e826-27f0-4988-bf22-1e8c327928ea@intel.com \
    --to=kai.huang@intel.com \
    --cc=Farrah.Chen@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox